(7) How can we destroy an object in javascript? - Quora
As already described, you cannot delete an object but you can mark it as DELETED.
The delete operator deletes only a reference, never an object itself. If it did delete the object itself, other remaining references would be dangling.
Javascript is garbage collected, you don't need to delete objects themselves - they will be removed when there is no way to refer to them anymore. So when you use delete operator on them, you're helping the garbage collector by providing it more information about which objects can be reclaimed.
Read full article from (7) How can we destroy an object in javascript? - Quora
No comments:
Post a Comment