Use-destructuring-assignment-with-the-rest-operator-to-reassign-array-elements

Use-destructuring-assignment-with-the-rest-operator-to-reassign-array-elements
0.0 0

#1

Tell us what’s happening:
Test “destructuring was used.” is fails.

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
  let [,,...arr] = list;
  // 
  // change code below 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/64.0.3282.167 Safari/537.36.

Link to the challenge:


#2

Thank you for being a beta tester. Please report this bug as a detailed GitHub Issue.


#3

const [,…arr] = source;


#4

@azzam1985, please, did this pass for you? Because I believe removing the first two array elements would mean using two leading commas.

const [,, ...arr] = source;