Tell us what’s happening:
Why my code don’t run if I don’t add const before [a, b,… shorterList] ? It runs on other consoles and give the desired result. So, what’s the logic here ?
Your code so far
function removeFirstTwo(list) {
[a,b,...shorterList] = list
return shorterList;
}
const source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const sourceWithoutFirstTwo = removeFirstTwo(source);
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36
Challenge Information:
ES6 - Destructuring via rest elements