ES6: Use Destructuring Assignment with the Rest Operator to Reassign Array Elements test facility won't run

Hitting cntrl + enter or clicking the ‘run test’ button seems to have no effect. The adjacent challenges test just fine.

This is my code in case its relevant:

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

Hi ozmos! While it’s being declared inside the destructuring section, arr is still a new variable being initialized. So it requires either a let or const before the square braces. =)

When the JavaScript is invalid, it seems like the tests just silently don’t run, which is quite unclear!

1 Like

Thanks, that fixed it