Use Clone And Spread Operator To Solve

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

I don’t know how you would get arr3 showing anything, since you are not even referencing an arr3 anymore.

I assume you meant arr2. The reason arr2 is undefined is your declared it but never assigned it a value.

Thanks I was slightly distracted…

const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2 = arr1
const cloneArr1ES6 = [...arr1]; // change this line
console.log(arr2);

What is your question?

I am all good, thanks again