Answers for "Use Destructuring Assignment with the Rest Operator to Reassign Array Elements"

0

Use Destructuring Assignment with the Rest Operator to Reassign Array Elements

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];
Posted by: Guest on May-04-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language