Hi,
You have the right idea but I think your code became confusing with all the indexing and calls to slice. I believe if you log to console arrNew.slice(0,1) you will see why it is not working.
SPOILER
arrNew.slice(0,1) // returns a nested array [ [ 1, 2, 3, 1, 2, 3 ] ]
//with only one array element
so below is not filtering what you think
arrNew.slice(0,1).filter(...)
Why not just call it arr as passed in the function arg list? That change alone would pass your code.
arr.filter(...)
I would suggest…
Only a slight change to your code to isolate the additional arguments into their own named array (which I named others here)
Refer to the passed array as arr as named in the arguments list of function instead of slicing it from the arguments
function destroyer(arr) {
let others =[];
// isolate additional arguments
// note i initialized to 1 to skip arr
for(let i=1;i<arguments.length;i++){
others.push(arguments[i]);
}
// now others is [2,3]
return arr.filter( function(i) { return !others.includes(i) });
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
There are other ways to capture the additional arguments in an array but this was most like your original code.