My code will not work everything is correct only this error Destructuring on list
should be used.
Your code so far
function removeFirstTwo(list) {
// Only change code below this line
const [,, ...arr] = list; // Change this line
// Only change code above this line
return arr;
}
const source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const sourceWithoutFirstTwo = removeFirstTwo(source);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Challenge: ES6 - Destructuring via rest elements
Link to the challenge:
Ignoring these lines can cause the tests to fail
Somehow, you happened to exactly replicate a solution to an old version of this Challenge.
Can you explain, my code is within the line…
You copied an old answer that has changes outside of the area you are supposed to edit.
You must not make any changes at all outside of that single line you were originally asked to change. Any changes outside of that single line can break the tests, because we want the variable names you were originally given to be used.
Can you show an example of how it should be writeen I kept the variables the same and it still did not work
function removeFirstTwo(list) {
// Only change code below this line
const [,, ...arr] = list; // 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);
I can’t write the answer for you, no.
vanessagp215:
return shorterList;
This says you need to use the variable name shorterList
.
You are using the variable name arr
instead. You have to use the variable name the code is telling you it wants.
replace all arr with shorterList