Question regarding Seek and Destroy Bonfire [Spoiler]

i just completed this bonfire, but i am not sure why the final solution was right. also is my callback redundant since .filter() iterates through the array anyway?

function destroyer(arr) {
  
  var init = arguments[0];
  var full = Array.from(arguments);
  var seek = full.slice(1, full.length);
  
  var slicer = function(){
  for(var i = 0; i < seek.length; i++){
  	for(var k = 0; k < init.length; k++){
    	if(seek[i] === init[k]) {
				init.splice(k, k+1);
        console.log("chopping " + init);
      }
    }
  }
  };
  
  init.filter(slicer);
  console.log("final " + init);
  
  return init;

}

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

MDN says the second argument in splice is the amount of elements to remove. i originally intended to remove 1 at a time, but ran into trouble where this version was not returning an empty array. i tried splicing from the end, from the beginning, but ultimately this (k+1) is what worked for me. can anyone explain my why removing more than 1 element did the trick?

on a side note, as far as DRY is concerned, is running a nested loop inside .filter() super wet since filter loops through the array, and then i am running an additional loop?

much appreciated.

U run additiomal loop, filter provide everything u need
Filter returns true if elm need to stay and false vice versa
I m on android and cant tell u what happend when u return nothin, but look even u return something u change array on whom u perform filter function with this splice. So u need to change array with returning boolean in filter function instead using splice in same, if u want to use filter. U wrote loop to iterate through array why then u need filter?

So if u want to use filter then iterate through first argument and in filter callback use perimeter for value and compare with one loop in this case somethin similar like your inner loop, and then if it consist that item retur false…

Also why second perimeter in splice not to be 1, maybe cause u messed up filter with splice…

Also u can instead of this

var init = arguments[0];
  var full = Array.from(arguments);
  var seek = full.slice(1, full.length);

Write this

var init = arr;
var seek = Array.prototype.slice.call(this, 1);

thanks a lot. i wasn’t quite comfortable with how the filter callback worked.