Tell us what’s happening:
Hello, I’m trying to pass this challenge and
though the code works, I’m getting the error of not applying destructuring assignment on the list parameter.
I checked up the solution, but no dice.
Your code so far
function removeFirstTwo(list) {
// Only change code below this line
const [a,b, ...arr] = list;
const shorterList = [...arr]; // Change this line
// Only change code above this line
return shorterList;
}
const source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const sourceWithoutFirstTwo = removeFirstTwo(source);
console.log(removeFirstTwo(source));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Challenge: ES6 - Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements
Link to the challenge: