Last active
June 15, 2018 17:58
-
-
Save eday69/facdda36018c12ff51134fcc41ddc94b to your computer and use it in GitHub Desktop.
freeCodeCamp Intermediate Algorithm Scripting: 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
// 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. | |
// Note | |
// You have to use the arguments object. | |
function destroyer(arr) { | |
// Remove all the values | |
const args = Array.from(arguments); | |
let theList=args.slice(1); | |
return args[0].filter(item => !theList.includes(item)); | |
} | |
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