Tell us what’s happening:
To start with, let me just state that the ES6 tutorials are absolutely terrible, and I have learned absolutely nothing from them. I know this statement has been echoed time and time again on these forums, but I just want to be sure my voice is added to the choir. Whoever wrote the ES6 curriculum needs to take a very detailed analysis of their abilities as a teacher and truly determine if this is an area they believe they are adept in.
Now, for this question. There is nothing in the tutorial that teaches how to duplicate an array. Information is giving about the spread operator being used for math methods, and explicitly states I cannot do something like:
let array2 = ...arr1;
Great, now do you mind telling me what argument does work for copying an array without just pointing to the original, so that I can change arr2 without changing arr1? Because nothing in your lesson teaches me what that syntax might look like.
Oh, it gets better. Let’s check out the help page for spread operator. Wait a second, it’s just more examples of how to use math methods to manipulate an array using the spread operator as an argument? Not a single example of how to assign an array the value of another array? The actual test in the lesson?
Terrific. So, now, for the 6th or 7th lesson in a row, I will be navigating to a different tutorial site to learn what this lesson is actually asking me to do. I have high hopes for fCC 7.0 fixing the JavaScript lessons and I hope that whoever writes the project will look through the hundreds of posts on these forums about how poorly written the ES6 section is.
Hilarious Edit: One last thing, the first google result is this website explicitly stating why using spread to copy an array is wrong. So not only does this lesson not teach you the correct thing, it actually teaches you poor syntax. God save the soul of the person who wrote this section.
Your code so far
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
(function() {
"use strict";
arr2 = ; // change this line
})();
console.log(arr2);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place