So I’m confused as to why the for loop is not continuing through. It removes the first item from the newly created x array, but not the subsequent items. Is this just a syntax thing or what? My result is (1,3,1,3).
function destroyer(arr) {
var x = Array.from(arguments);
x.shift();
var result = arr.filter(function(val){
for (var i =0; i <=x.length; i++){
return val !== x[(i)];
}
});
// Remove all the values
return result;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/seek-and-destroy