Created
January 13, 2016 11:16
-
-
Save peysal/7c53ac7759aa510dec63 to your computer and use it in GitHub Desktop.
Bonfire: Seek and Destroy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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