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:
Here's one possibility:
valuesArr = removeValFromIndex.reduceRight(function (arr, it) { arr.splice(it, 1); return arr; }, valuesArr.sort(function (a, b) { return b - a }));
Example on jsFiddle
MDN on Array.prototype.reduceRight