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:
Sounds like Apply could be what you are looking for. maybe something like this would work?
Array.prototype.splice.apply(valuesArray, removeValFromIndexes );