Tell us what’s happening:
the code works, but I cant wrap my head around what
“var args = Array.prototype.slice.call(arguments).slice(1)” is doing. can someone help explain this?
Your code so far
function destroyer(arr) {
// Remove all the values
var args = Array.prototype.slice.call(arguments).slice(1);
for (i = 0; i < arr.length; i++){
for(j = 0; j < args.length; j++){
if(arr[i] === args[j]){
delete arr[i];
}
}
}
return arr.filter(Boolean);
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (X11; CrOS x86_64 10323.58.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.167 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/seek-and-destroy