January 2018
Intermediate to advanced
332 pages
7h 36m
English
This should be pretty obvious by now; we discussed how the GC mechanism determines a root (which is the window object) and treats everything on the root and its children as active and never marks them for garbage collection.
So, the next time you forget to add a var to your variable declarations, remember that the global variable that you are creating will live forever and never get garbage collected:
function test() { a = 10; // created on window object a += 3; return a;}
Read now
Unlock full access