Seek and Destroy - filter function problems

Tell us what’s happening:
It runs but nothing happens. I think the issue is with the filter function. Can someone give me a hint?

Your code so far

  var index = 0;
  while (index < removeme.length){
  if (value == removeme[index]){
    return false;
  }
  else 
  {
    return true;
  }
    index++;
  }
}

function destroyer(arr) {
  // Remove all the values
  
  //covert arguments to array
  var array = arr.slice.call(arguments);
  var realarray = array[0];
  var removeme = array.slice(1);
  
  
  
  realarray.filter(value,removeme);

  
  return realarray;
}

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36.

Link to the challenge:

I would suggest just putting your other code within the function. I’ll have to look some more if I want to see what is wrong.

Check out this article. The filter function is not designed to receive addition parameter the way you are trying to use.

As @n_haniph sugested, put all the code in the same destroyer function and call the filter for each element in the removeme array.

Another tip - Any variable declared outside of a function belongs to the global scope, and is therefore accessible from anywhere in your code. Each function has its own scope, and any variable declared within that function is only accessible from that function and any nested functions.

Thanks. I finally figured it out. I used filter and indexof.