Tell us what’s happening:
Describe your issue in detail here.
I dont really understand this line of code:
let valsToRemove = Object.values(arguments).slice(1);
why cant we just use arr.slice(1);
**Your code so far**
function destroyer(arr) {
let valsToRemove = Object.values(arguments).slice(1);
for(let i = 0; i < arr.length; i++){
for (let j = 0; j < valsToRemove.length; j++) {
if (arr[i] === valsToRemove[j]) {
delete arr[i];
}
}
}
return arr.filter(item => item !== null);
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
Challenge: Seek and Destroy
Link to the challenge: