In my code, I am trying to work with a sparse Array. I have written a pseudocode snippet where I use delete array[id] to remove elements and adjust the length of the array accordingly.
....
deleted = 0;
...
if (condition) { delete array[id]; deleted++;}
...
array.length -= deleted;
After running this code, the array ends up having the expected length but strangely it is empty! Can anyone shed some light on why this might be happening?