Last active
December 29, 2017 09:30
-
-
Save mmloveaa/6093f6141b19b70677b0ace85a83d20d to your computer and use it in GitHub Desktop.
5/3 Seek and Destroy
This file contains hidden or 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
You will be provided with an initial array (the first argument in the destroyer function), | |
followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments. | |
function destroyer(arr) { | |
var myArguments = []; | |
for (var i=1; i<arguments.length; i++){ | |
myArguments.push(arguments[i]); | |
} | |
return arr.filter(function(remove){ | |
return myArguments.indexOf(remove) < 0; | |
}); | |
} | |
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