Seek and Destroy Challenge, why my solution isn't working?

Hello, hope you can help me, I cannt understand why my solution is not working:

function destroyer(arr) {
const valsToRemove = [];
for(let i=1; i<arguments.length; i++) {
  valsToRemove.push(arr[i]);
}

console.log(valsToRemove);
return arr.filter(function(val) {
  return !valsToRemove.includes(val);
});
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

I used for loop in the beggining cause I read in the docs is better for optimization than slice with arguments.

Hope you can help, thank you very much in advance!

You’re looping over arguments, so it seems strange that you’re accessing arr here.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.