Seek and Destroy - Need tips/advice

Seek and Destroy - Need tips/advice
0

#1

Tell us what’s happening:
I’m not passing the challenge entirely. Please point out what I can improve without giving away anything. Thanks

Your code so far

function destroyer(arr) {
 for (var i = 0; i < arr.length; i++) {
   for (var j = 1; j < arguments.length; j++) {
     if (arr[i] === arguments[j]) {
       arr.splice(i, 1);
     }
   }
 }
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Link to the challenge:


#2

.splice()ing the array removes some elements and shifts the remaining elements to fill in the void. This means that the element after the spliced one takes the emptied slot, then i increments, effectively skipping that element.