main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//jshint esversion: 6
function isFoundInArray(value) {
  return this != value;
}
function destroyer(arr) {
  // Remove all the values
  var args = [...arguments];
  var arrayToDestroy = args.shift();

  //since we shift()-ed args, which is a destructive operation, it now is an array with just the values to filter by.
  for (var i = 0; i<args.length;i++) {
    var filterBy = args[i];
    //argument passed to filter() after callback sets 'this' in the callback function.
    arrayToDestroy = arrayToDestroy.filter(isFoundInArray,filterBy);
  }
  return arrayToDestroy;
}

destroyer([7,8,9,10,1,3], 3,8, 9);
Native Browser JavaScript