I have the following array that I'm trying to remove values from:
transformedColumns [ "Item No", "Item Type", "Item State", "Valid Design_text", "Currency Code", "Base Item_no", "Comclass Name" ]
I'm just trying to remove all values from the array with the splice function:
var indexPos = [0, 1, 3, 4, 5, 6];
for (var k = 0; k < indexPos.length; k++) {
transformedColumns.splice(indexPos[k], 1);
}
The result of transformedColumns after the execution of the code is:
transformedColumns [ "Item Type", "Valid Design_text", "Currency Code", "Comclass Name" ]
I guess the reason to the problem Is that when you do a splice, the whole order in the array are changed, so the indexes does not match in some way? If it's so, how can I remove value from an array in this kind of way?