# Seek and Destroy filter function

**URL:** <https://forum.freecodecamp.org/t/seek-and-destroy-filter-function/21295>\
**Category:** General\
**Created:** [July 19, 2016, 3:09am UTC](https://forum.freecodecamp.org/t/seek-and-destroy-filter-function/21295 "2016-07-19T03:09:44Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![theabytheriver](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/theabytheriver/32/158901_2.png) [@theabytheriver](https://forum.freecodecamp.org/u/theabytheriver)\
**Post date:** [July 19, 2016, 3:09am UTC](https://forum.freecodecamp.org/t/seek-and-destroy-filter-function/21295/1 "2016-07-19T03:09:44Z")

</div>

Hello, I am new to this whole programming thing and struggling with algorithms right now.

I have come up with this solution, however I can’t seem to get the return part of my filter function right.

> function destroyer(arr) {  
> // Remove all the values  
> //turn arguments into array, starting from the second (1) arg  
> var args = Array.prototype.slice.call(arguments,1);
> 
> ```
> //filter function, return value that doesn't match the arguments
> function destroyThis(val){
> for (var i = 0; i < args.length; i ++){  
> //return args.indexOf(x) === -1;
> **return val != args[i];**
> }
> }
>   
> //filter the working array
> arr = arr.filter(destroyThis);
> return arr;
> }
> 
> ```

Can anyone help me with the bold part? My current solution only check the last of the arguments.  
Much appreciate. 🙂

---

_[View the full topic](https://forum.freecodecamp.org/t/seek-and-destroy-filter-function/21295)._
