Use Destructuring Assignment with the Rest Operator

Tell us what’s happening:

Again stuck with destructuring.

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
  const {list:arr}= [3,4,5,6,7,8,9,10] // 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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-operator-to-reassign-array-elements

Is it ok?

const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
  "use strict";
  // change code below this line
  const [...arr]= source; // change this
  // change code above this line
  return arr;
}

U are a beauty…thanks for the hints… i sot it out.

again easy but confusing, if you look at the given example the answer is right there, however the ambiguous part is the [a,b,] swapping before the …arr , reading the explanation of how to solve the problem it doesn’t clearly explain you need to use the a,b, .

you should omit the first and second element using destructing rest operator

and don’t forget to change the source to list since this is parameter pass to the function