Tell us what’s happening:
Could I also use the clone and spread operator to solve this problem? When I try the code below I get arr2 undefined
Your code so far
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
const cloneArr1ES6 = [...arr1]; // change this line
console.log(arr2);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0
.
Challenge: Use the Spread Operator to Evaluate Arrays In-Place
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place