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);