The previous loop logic was incorrect, because it
was destroying the localStorage array as it iterated. The
proper way to delete elements in an array by index
is to iterate backwards, so you don't destroy the
array while you're looping.
The new test fails before the fix but succeeds after.
The previous loop logic was incorrect, because it was destroying the localStorage array as it iterated. The proper way to delete elements in an array by index is to iterate backwards, so you don't destroy the array while you're looping.
The new test fails before the fix but succeeds after.