I solve this challenge but something in the code I did not understand some thing on my code
Is the arr
variable out of the function same the arr
inside the function?
My code so far
const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
"use strict";
// Only change code below this line
const [a, b, ...arr] = list; // Change this line
// Only change code above this line
return arr;
}
const arr = removeFirstTwo(source);
console.log(arr);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:81.0) Gecko/20100101 Firefox/81.0
.
Challenge: Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements
Link to the challenge: