Answer the question
In order to leave comments, you need to log in
How to properly do Destructuring Assignment in ES6?
Hey! I can't complete the lesson on Freecodecamp - ES6: Use Destructuring Assignment with the Rest Operator to Reassign Array Elements ( https://beta.freecodecamp.org/en/challenges/es6/us...
Here is the code:
const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
"use strict";
// change code below this line
let [,,...arr] = list; // change this
// change code below this line
return arr;
}
const arr = removeFirstTwo(source);
console.log(arr); // should be [3,4,5,6,7,8,9,10]
console.log(source); // should be [1,2,3,4,5,6,7,8,9,10];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question