As I work on a complex AJAX control class, I've encountered an interesting question.
For instance, imagine I store all page elements in an array upon initialization.
When a user triggers an AJAX-enabled link, specific parts of the content are replaced by the data retrieved from the AJAX call through subsequent methods.
Now, what if after the AJAX call finishes and replaces nodes in the content section, the previously stored nodes in the array become null or undefined (or some other indication of being inactive)?
When I iterate through the array again, do these elements cease to exist? Or do they still occupy space in their old index, just inaccessible?
It may seem like a trivial question, but I'm essentially trying to understand if there is any form of detection and garbage collection for 'dead' elements in a JavaScript array.
Thanks and best wishes.