Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
what is the use of adding triple dot in array in javascript?

What is the use of adding triple dots in an array in javascript?

my code sample is:

let array = [newArray]

and

let array = [...newArray]*
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Adding triple dots on an array is called spread syntax

By using it like this newArray = [...existingArray], we spread the existingArray into newArray so newArray has all the items of existingArray now.

Common use case of this syntax is to add new items into a new array with the existing items from another array

const oldArr = [2,3,4];
const newArr = [1,...oldArr]; //newArr = [1,2,3,4]

//If you put it like this..
const oldArr = [2,3,4];
const newArr = [oldArr]; //newArr = [[2,3,4]]

See this for more info : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!