Tell us what’s happening:
But i dont know why it won´t pass
Your code so far
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2 = [];
arr2.push(...arr1);
console.log(arr2);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36
.
Challenge: Use the Spread Operator to Evaluate Arrays In-Place
Link to the challenge:
Two issues
- You were not supposed to change the definition of
arr2
.
- You do not want to use push. Does your console log look right?
[ [ 'JAN', 'FEB', 'MAR', 'APR', 'MAY' ] ]
The challenge is to change one line of code, line 4. Line 2 should be:
let arr2;
The concat method should be helpful to solve this in one line.
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
arr2 = []; // Change this line
console.log(arr2);
look at the above where it says change this line, Think about how you can user the operator in that line