Seek and Destroy why my wrong?

Tell us what’s happening:
why my method is not correct?

Your code so far

function destroyer(arr) {
  // Remove all the values
  return arr.filter(function(x) {
      for (var j = 1; j < arguments.length; ++j) {
        if (arguments[j] == x)   return false;
      return true;

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_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:

That’s because you have a different sets of arguments inside the filter function:

function destroyer(arr) {
 console.log(arguments) // here arguments is an object

return arr.filter(function(x) {
  console.log(arguments) // here arguments is different, it refers to the filter function

You can use ES6 arrow function, since they don’t have their own

or store the one you need into a variable and access it inside the filter function

function d(arr){
  var myArgs = arguments...

 arr.filter(function(x) {
  // you can access myArgs here

hope it make sense :slight_smile:


Oh… I got it,thank you very much.:grinning:

In your code, there are two very different arguments objects. The first one belongs to the destroyer function and the other one belongs to the filter callback function. Add a console.log(arguments) to the destroyer function’s first line and put another inside the first line of the filter’s callback function so you can see the difference.