I am trying to loop through all the arguments in my function (except the first) and filter out the numbers that i am looping in the array (which would be the first argument). I am not sure why this is not working. Thanks.
function destroyer(arr) {
// Remove all the values
for(let i = 1; i < arguments.length; i++){
arr = arr.filter(function(x){
return x !== arguments[i];
})
}
return arr;
}
console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3));
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
.
Link to the challenge: