Skip to content

Instantly share code, notes, and snippets.

@ericcgu
Created September 12, 2015 13:16
Show Gist options
  • Save ericcgu/d818341b1f63123340d5 to your computer and use it in GitHub Desktop.
Save ericcgu/d818341b1f63123340d5 to your computer and use it in GitHub Desktop.
destroyer
function destroyer(arr) {
var cleanArray = arguments[0];
for (var i = 1; i < arguments.length; i ++){
cleanArray = without(cleanArray, arguments[i]);
}
return cleanArray;
}
function without(array, what){
return array.filter(function(el){
return el !== what;
});
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment