I am trying to remove all the rows that don't have the value '2A' or '2B' but whenever I execute the code it deletes every row except the first one.
Here is my bit of code :
function supprimerColonnesInutiles() {
for(i = 1; i < data.length; i++) {
if(data[i][13] === '2019-09-30'){
data.splice(i);
}
if(data[i][2] !== '2A'){
data.splice(i);
}
}
}
This code works perfectly to delete every row with the 2019 date but fails to do what I expect it to do to delete rows that contain 2A as a value (i'd like to keep 2B values as well).
here is the csv file that serves as my array, as you can see the second column contains 2As and 2Bs but also number from 1 to 100.
This is what I get if I execute the code enter image description here
and here is my csv/array enter image description here
My question is what could be causing this issue and how can I fix it ?