I have two arrays. The first array contains some values while the second array contains indices of the values which should be removed from the first array. For example:
In pure JS you can loop through the array backwards, so splice() will not mess up indices of the elements next in the loop:
splice()
for (var i = arr.length - 1; i >= 0; i--) { if ( yuck(arr[i]) ) { arr.splice(i, 1); } }