Created
December 6, 2015 22:33
-
-
Save anonymous/7aa77f27ddced4fde3c4 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/fcc0208647c 's solution for 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
// Bonfire: Seek and Destroy | |
// Author: @fcc0208647c | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-seek-and-destroy# | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function destroyer(arr) { | |
var slicedArgs = Array.prototype.slice.call(arguments, 1); | |
console.log(slicedArgs + " are my args"); | |
mylist = arguments[0]; | |
console.log(mylist + " Is my list"); | |
results = []; | |
good = []; | |
for (i=0;i<mylist.length;i++) { | |
console.log(slicedArgs.indexOf(mylist[i])); | |
if (slicedArgs.indexOf(mylist[i]) !== -1) { | |
results.push(mylist[i]); | |
} else { | |
good.push(mylist[i]); | |
} | |
} | |
return good; | |
} | |
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