Tell us what’s happening:
Hey folks, I’ve been messing with what I thought would be a solution for a couple hours now and getting to the point of pulling my hair out. Can anyone tell me why this wouldn’t work?
Your code so far
function destroyer(arr) {
// Remove all the values
var args = Array.prototype.slice.call(arguments);
for (var i = 0; i < arr.length; i++) {
for (var j = 0; j < args.length; j++) {
if (arr[i] === args[j] && i !== -1) {
arr.splice(arr[i], 1);
}
}
}
return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/seek-and-destroy