JavaScript arrays
The spread operator is a useful and quick syntax for adding items to arrays, combining arrays or objects.
let arr1 = [1, 2, 3]; let arr2 = [4, 5]; let newArray = [...arr1, ...arr2]; console.log(newArray); // Output: [1, 2, 3, 4, 5]
Spread Operator
Answered by Double
Last updated on Sep 18, 2021
Share
Comments
Add comment