The following code works fine as arr2 is empty, and arr2 got the contents of arr1, but I’m really confused that if arr2 is not empty, like arr2 = [‘JUNE’, ‘JULY’], anybody can tell me how I can put arr1 and arr2 together? I hope I’ve made me clear, thanks.
Your code so far
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY']; let arr2; arr2 = [...arr1]; console.log(arr2);
Your browser information:
User Agent is:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36
Challenge: Use the Spread Operator to Evaluate Arrays In-Place
Link to the challenge: