Hello,
Could you plz tell me why it does not pass my code while the output displayed in console is correct?
const arr1 = [‘JAN’, ‘FEB’, ‘MAR’, ‘APR’, ‘MAY’];
let arr2;
arr2 = ;
arr2.push(arr1); // Change this line
console.log(arr2);
Your code so far
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
arr2 = [];
arr2.push(...arr1); // Change this line
console.log(arr2);
here s the question:
Copy all contents of arr1
into another array arr2
using the spread operator.
Thanks
sara
Your code so far
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
arr2 = [];
arr2.push(...arr1); // Change this line
console.log(arr2);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Challenge: ES6 - Use the Spread Operator to Evaluate Arrays In-Place
Link to the challenge: