ES6 - Destructuring via rest elements

Tell us what’s happening:

I am working on ES6 - Destructuring via rest elements in the JavaScript Algorithms and Data Structures.
I have not been able to fix this challenge

Your code so far

function removeFirstTwo(list) { 
  const [a, b, ...arr] = list;
  return list;
}

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/119.0.0.0 Safari/537.36

Challenge Information:

ES6 - Destructuring via rest elements

Can you say more? What isn’t passing? What have you tried to troubleshoot?

Is this what you are supposed to return?

You’re on the right track.

At the moment, the code is saying list is made up of three parts:
a + b + …arr

Something needs doing to separate the third argument.

Also, are you currently returning the correct variable?

Happy coding

And a small tip: use the console.log to see what’s happening.

const source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
the function removeFirstTwo(list) should get me this array at last, [3, 4, 5, 6, 7, 8, 9, 10],
having removed the first two items.

Here is the challenge am working on

Use a destructuring assignment with the rest syntax to emulate the behavior of Array.prototype.slice() . removeFirstTwo() should return a sub-array of the original array list with the first two elements omitted.

function removeFirstTwo(list) {

return list;

}

const source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

const sourceWithoutFirstTwo = removeFirstTwo(source);

@Teller Your hint has worked,
function removeFirstTwo(source) {
const [a, b, …arr] = source;
return arr;
}

const source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const sourceWithoutFirstTwo = removeFirstTwo(source);
I was actualy surposed to change the parameter list to source to match the give array, so as to be correctly evaluted in the function.
Thanks a lot.

@awesomeuname29
Thanks a lot. I noted the place error was.

I don’t need you to copy-paste instructions at me!

I highlighted list here because you aren’t supposed to return the entire list.