Help me understand Seek and Destroy

Tell us what’s happening:

the code works, but I cant wrap my head around what
“var args =” is doing. can someone help explain this?

Your code so far

function destroyer(arr) {
  // Remove all the values
  var args =;
  for (i = 0; i < arr.length; i++){
    for(j = 0; j < args.length; j++){
      if(arr[i] === args[j]){
        delete arr[i];
  return arr.filter(Boolean);

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; CrOS x86_64 10323.58.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.167 Safari/537.36.

Link to the challenge:

1 Like

Looking at the solutions, the “.slice(1)” isnt needed. which is even more confusing.

var args =;

The above line creates an array out of the arguments object which contains all the arguments passed to the function. The array reference is then assigned to the variable args.

1 Like

what about

You already know what slice does, but for call, take a look at the documentation.


1 Like

You may find this SO question to be beneficial:

Copying from the second answer:

Let me try to simplify: arguments is not an array. Slice() is an array method. To use Slice() on the arguments object we must take the arguments and pass them into the slice array method using call.

Since the call to slice returns an array, there is no need to call slice a second time.