Javascript: using the spread operator
Example:
let arr1 = [1, 2, 3];
let arr2 = [...arr1, 4, 5, 6];
The spread operator can expand an iterable into individual elements.
Solution:
console.log(arr2); // Outputs: [1, 2, 3, 4, 5, 6]
Example: Solution:Javascript: using the spread operator
The spread operator can expand an iterable into individual elements.
let arr1 = [1, 2, 3];
let arr2 = [...arr1, 4, 5, 6];
console.log(arr2); // Outputs: [1, 2, 3, 4, 5, 6]