Https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-use-the-spread-operator-to-evaluate-arrays-in-place/301222

I tried resolving the “Use the spread operator to evaluate arrays in place” challenge, a little bit differently than the solution provided. I had the same result. And I am curious as to why my approach might not be acceptable.

This is my code:

const arr1 = [‘JAN’, ‘FEB’, ‘MAR’, ‘APR’, ‘MAY’];

let arr2;

arr2 = .concat(…arr1); // Change this line

console.log(arr2);

Aside from the fact that concat takes as parameters one or more arrays? It may be working, and it isn’t actually wrong, but the spread here serves no purpose.

https://devdocs.io/javascript/global_objects/array/concat

1 Like

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