Tell us what’s happening:
Your code so far
function destroyer(arr) {
// Remove all the values
if(arguments.length > 1){
for(let i=1;i<arguments.length;i++){
let x = -1;
while(x=arr.indexOf(arguments[i],x+1) != -1){
arr.splice(arr.indexOf(arguments[i]),1);
}
}
}
return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
function destroyer(arr) {
// Remove all the values
if(arguments.length > 1){
for(let i=1;i<arguments.length;i++){
let x = -1;
while(x=arr.indexOf(arguments[i],x+1) != -1){
arr.splice(arr.indexOf(arguments[i]),1);
}
}
}
return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy/