Question 3 of 10Pro Only
How does memory management work in JavaScript, and what are the common causes of memory leaks in frontend applications?
Sample answer preview
JavaScript manages memory automatically through a garbage collector, so you never free memory by hand. The collector works on reachability: starting from a set of roots, mainly the global object and the current call stack, it marks everything reachable and reclaims the rest.
garbage collectionreachabilitygenerationaldetached DOMevent listenerscleanup function