Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jrjames83/d6305b75e957d81a03d8 to your computer and use it in GitHub Desktop.
Save jrjames83/d6305b75e957d81a03d8 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/fcc0208647c 's solution for Bonfire: Seek and Destroy
// 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