Intermediate Algorithm Scripting : Seek and Destroy

Hi guys,
Help me please to understand.
The original task here is
"You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments."

Question:
can anyone explain the behavior of “splice()” here, please
and how can I use it to get what I want (can I?:smile:).

function destroyer(arr) {

  var args = Array.prototype.slice.call(arguments);

  

    for (var j = 0; j < args.length; j++) {

      for (var i = 0; i < arr.length; i++) {

      if (arr[j] === args[i]) {

        arr.splice(i,1);

      }

    }

  }

  return arr;

}

console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3)); //answer:  [1, 1] - OK
console.log(destroyer([3, 5, 1, 2, 2], 2, 3, 5)); //answer: [1, 2] - ???

Note that splice will alter the original array.
Once your program hits arr.splice(i,1);, all other references to arr will be affected, arr.length and arr[j] will produce incorrect results…