1、数组方法filter();
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
function destroyer(arr) {
// Remove all the values
var tmpArr = arguments[0];
var arg = [];
var ans = [];
for (var i = 1; i < arguments.length; i++) {
arg.push(arguments[i]);
}
function isInArg(element) {
for (var i = 0; i < arg.length; i++) {
if (element == arg[i]) return false;
}
return true;
}
var filtered = tmpArr.filter(isInArg);
return filtered;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3); // [1, 1]
destroyer([ 2, 3, 2, 3], 2, 3); // []