Given an array and subsequent unknown number of arguments, how can I remove all elements from the initial array that are of the same value as these arguments? This is what I have so far:
function destroyer(arr) {
var arrayOfArgs = [];
var newArray = [];
for (var i = 0; i < arguments.length; i++) {
newArray = arr.filter(function (value) {
return value !== arguments[i + 1];
});
}
return newArray;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);