Algorithm Scripting: Seek and Destroy issue

Tell us what’s happening:
Hi, I wanted to merge all arguments except for “arr” into one, and then filter “arr” to only return items which aren’t present in “args”, but it seems not to work. Could you advise me how to fix it please?

Your code so far


function destroyer(arr) {

var args = Array.prototype.slice.call(arguments, 1);
return arr.filter(item => !args.indexOf(arr) === -1);
}

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/75.0.3770.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy

Why are you refererencing arr as the argument for indexOf?

Also, what exactly do you think the following is comparing?

!args.indexOf(arr) === -1

Well I tried to write (arr[i]), but it didn’t work either

Hmm I think it must be without !, just “if args contain no elements of arr”, i.e. their index is -1

Can you think of a way to use item here (since you reference it as the arrow function parameter)? What do you think item represents?

Any value of an array?

Not any value of an array. item represents each item in the array as it is being iterated.

Alright, should I just use arr[item] instead?

I think you need to review the filter challenge.

Use the filter Method to Extract Data from an Array