Tell us what’s happening:
Hi, I don’t understand what’s doing the spread operator (…) in this code that it is different from simply writing arr instead of …arr
Your code so far
//what's the difference between this:
const arr = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2 = [...arr];
console.log(arr2); // returns [ 'JAN', 'FEB', 'MAR', 'APR', 'MAY' ]
//and and this?:
const arr = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2 = arr;
console.log(arr2); // returns [ 'JAN', 'FEB', 'MAR', 'APR', 'MAY' ]
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
.
Challenge: Use the Spread Operator to Evaluate Arrays In-Place
Link to the challenge: