Hi,
I’m working on problem ’ Intermediate Algorithm Scripting: Seek and Destroy’. I can’t post links yet: learn . freecodecamp . org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy
Is there an easy way for the argument values to be all removed from the array?
My code:
function destroyer(arr, b, c) {
for (var i = 1; i < arguments.length; i++) {
if (arr.indexOf(arguments[i]) > -1) {
arr.splice(arr.indexOf(arguments[i]), 1);
}
}
console.log(arr);
//return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Gives me [1, 1, 2, 3], but I want [1, 1].