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:
I suggest you use Array.prototype.filter
var valuesArr = ["v1","v2","v3","v4","v5"]; var removeValFrom = [0, 2, 4]; valuesArr = valuesArr.filter(function(value, index) { return removeValFrom.indexOf(index) == -1; })