Array Spread Operator
Multiple Choice Easy
Question
What does [...[1,2], ...[3,4]] produce?
Hint
Spread flattens array elements into the new array.
Explanation
The spread operator ... expands an array into its individual elements. So [...[1,2], ...[3,4]] creates a new array [1,2,3,4]. This is the modern way to concatenate arrays, replacing arr1.concat(arr2). It creates a shallow copy, not a deep one.
Related Resources
Related Lessons
- Arrays
Learn how arrays work.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.