ES6 - Use the Spread Operator to Evaluate Arrays In-Place

Tell us what’s happening:
Describe your issue in detail here.
Is it the console.log(arr2); or i copy and paste const arr2 = [“JAN”, “FEB”, “MAR”, “APR”, “MAY”]; and put with arr1?
Your code so far

const arr2 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
 let arr1[];
arr2 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
arr1 = [...arr1]; // Change this line


Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: ES6 - Use the Spread Operator to Evaluate Arrays In-Place

Link to the challenge:

You added things that you shouldn’t have. You were only supposed to change one line (the line with the comment that says “Change this line”). I would restart the lesson to get the original JS back and then only change that line.

Explain in your own words what this is supposed to do.

I did use my own words it was just was a idea from the last question

The spread syntax you have is correct but you are spreading the wrong array.

You also have two syntax errors in the code you added (which shouldn’t be added anyway).

  • let arr1[]; is not a valid declaration.

  • arr2 was declared using const and can not be reassigned or redeclared.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.