Użyj przypisania destruktururowego z operatorem odpoczynku, aby ponownie przypisać elementy tablicy
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 this
// 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];
Nikhil Carpenter