Seek & Destroy, what's wrong with this solution?

Hey everyone,

I came up with another solution for the Seek and Destroy algorithm and I’m trying to figure out what some unintended consequences could be using this in the long term. I’m doing some pretty weird stuff setting the gainer equivalent to a filtered version of the gainer within the for loop… is that bad practice?

// jshint esversion:6

function destroyer(arr) {
  // Remove all the values
  var gainer = Array.prototype.slice.call(arguments[0]);

  
  for (var i = 1; i < arguments.length; i++) {
    console.log(arguments[i], gainer);
    gainer = gainer.filter(el => el !== arguments[i]);
  }
  return gainer;
}

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

My solution was virtually the same:

function removeValue(val) {
	 return (val != this);
}

function destroyer(arr) {
  var testArr = arr;
  var args = Array.from(arguments);
  for (var i = 1; i < args.length; i++) {
	testArr = testArr.filter(removeValue, args[i]);
  
  }
  
  return testArr;
}

I’m not sure why you think it is bad practice.