Use Destructuring Assignment with the Rest Operator to Reassign Array Elements

Tell us what’s happening:

Your code so far

const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
  "use strict";
  // change code below this line
  list = [a,b,...arr]; // change this
  // change code above 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];

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:

You haven’t quite got the syntax right. Compare your line:

list = [a,b,...arr];

with the example:

const [a, b, ...arr] = [1, 2, 3, 4, 5, 7];

Of course, you’re going to use list instead of [1, 2, 3, 4, 5, 7] but you have to get it into the right place.

Thank you. I have just passed this challenge.