I have a sparse array; that is, an array in which some elements have been delete
d. Elements are constantly being added and deleted from the middle, so it is very large and very sparse.
At some point, every element will be undefined
, but the length
won't be 0 — so it is empty, but it doesn't express that. How can I check if this has happened?
The best that I can think of is to loop through the whole monster and check if they're all undefined
. But that would be too inefficient for my application.