ES6 - Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements

Tell us what’s happening:
Describe your issue in detail here.
“Destructuring on the list should be used” wont check… any solutions.
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 [a, b, ...arr] = list;
  // 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/107.0.0.0 Safari/537.36

Challenge: ES6 - Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements

Link to the challenge:

You copied an old answer instead of writing a solution that respects the lines // Only change code below this line, // Only change code above this line, and // Change this line. Ignoring instructions in the comments can lead to your solution failing.


I strongly recommend against looking at answers from the guide until you have written your own solution.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.