I have an array INTERVALS and I want to remove a subset of elements from this array.
I tried using for loop and splice, but it is not working as desired. It seems the for loop should not modify the array. Any help?
function remove_intervals(list) {
for(i=0; i < INTERVALS.length; i++) {
var o = INTERVALS[i];
if(o in list) {
clearInterval(o);
INTERVALS.splice(i,1);
}
}
}