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

112
Views
Use spread operator over a spread operator on an 2-d array

Is there a way to use a spread operator over another spread operator?

const arr = [[1,2,3],[4],[5,6],[7,8,9]];
const spreadArr = [...arr];  // This works
console.log(spreadArr); // [[1,2,3],[4],[5,6],[7,8,9]]

But, can we somehow chain it like we can over the map, filter or other methods?

With the output to probably spread the 2d-array into a 1-d one. And the code or syntax to be something like:

const doubleSpreadArr = [...(...arr)];
console.log('The expected output to be: ', doubleSpreadArr);
// The output expected to be [1,2,3,4,5,6,7,8,9]

How does the spread operator exactly work in JavaScript(v8, or any other engine)?

about 4 years ago · Juan Pablo Isaza
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!