# Filter method not working. Any ideas?

Hello. I’m trying to complete the Seek and Destroy algorithm challenge. I’m trying to filter out any of the numbers passed as the second and third arguments.

Here is my code so far.

``````function destroyer(arr) {
let argArray = arguments;
let filteredArray = argArray.filter(x => x !== arguments || x !== arguments);
console.log(filteredArray);

return arr;
}

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

I was hoping this would create an array containing any numbers that don’t match the second and third arguments passed to `destroyer()`. But the filter method doesn’t work when it has the OR operator.

This works.

``````let filteredArray = argArray.filter(x => x !== arguments);
``````

But this doesn’t.

``````let filteredArray = argArray.filter(x => x !== arguments || x !== arguments);
``````

Any ideas?

Consider this, in the case written there the number should be kept if it is both different than 2 AND 3

If you write that the number shouldn’t be 2 OR 3, then 2 is not 3 so it returns true, 3 is not 2 so it returns true

I suggest also to consider the case in which there is a different number of arguments, if you need an hint just ask!

Ohhh of course! That logic doesn’t work does it. Thanks for pointing that out. Hmm, back to the drawing board.

Are you asking a question about the challenge? If so you will do better using the Ask for help button

If you are just sharing the answer it is preferred to not have answers around the forum, many people don’t like the spoilers, thank you for understanding - it is not even the answer to this challenge

So the symbols `||` is not really OR. I’ve seen even senior programmers get this wrong.

When used in parenthesis it can have that effect though.

Example

``````null || false // false
undefined || false // false
3 || 9 // 3
9 || 3 // 9
``````

Do you see the pattern?
You can basically sum it as:
`a || b`

or

``````if (Boolean(a) === true){
return a;
}
else {
return b;
}
``````

The reason why (a || b) seems like OR in javascript is because inside the parenthesis is evaluated first.
(3 || 9) is (3) and when you use an if statement `if (3){....}` the 3 is coerced into a boolean, which is true.