I have a remove[] array which has all the index positions of all the element with 0 in the data array (as below).
data array:
Retail,1,Utilities,1,Fo
I use a library called DevBox.Linq.JS
It basically adds Linq type functionality to Javascript Arrays. For example, it adds "Remove":
Array.prototype.Remove = function (condition) {
if (condition == undefined) {
console.error('Informe a expressão para executar a tarefa.')
return;
}
for (var i = 0 ; i < this.length ; i++) {
if (condition(this[i]))
this.splice(i, 1);
}
}
This way you can use it with a lambda like this:
myArray.remove(i=>i=="valueToDelete");
Hope it helps, It already has all the functionality so you don't have to deal with that pesky splice.