Skip to content

Instantly share code, notes, and snippets.

@peysal
Created January 13, 2016 11:16
Show Gist options
  • Save peysal/7c53ac7759aa510dec63 to your computer and use it in GitHub Desktop.
Save peysal/7c53ac7759aa510dec63 to your computer and use it in GitHub Desktop.
Bonfire: Seek and Destroy
function destroyer(arr) {
var args = new Array(arguments.length);
for(i=0; i<args.length;i++){
args[i] = arguments[i];
}
console.log('| args[0]:' + args[0]);
var result = args[0].filter(function(element){
for(o=1; o<args.length;o++){
console.log('| making sure element:' + element + ' is not:' + args[o]);
if(element !== args[o])
return true;
else
return false;
}
});
console.log('| left with result:' + result);
return result;
}
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