Skip to content

Instantly share code, notes, and snippets.

@jsjoeio
Created May 20, 2017 23:02
Show Gist options
  • Save jsjoeio/42711ed81a739bec5d4d04309c104218 to your computer and use it in GitHub Desktop.
Save jsjoeio/42711ed81a739bec5d4d04309c104218 to your computer and use it in GitHub Desktop.
function destroyer(arr) {
// Remove all the values
var args = Array.prototype.slice.call(arguments);
for(var i = 0; i < arr.length; i++){
for(var j = 0; j < args.length; j++){
if(arr[i] === args[j]){
delete arr[i];
}
}
}
return arr.filter(Boolean);
}
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