Explain it in 60 seconds
Garbage collection and memory leaks in JavaScript
Frontend Engineering · JavaScript Core · Intermediate
How does garbage collection work in JavaScript, and what causes memory leaks?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Automatic: reachable objects kept, unreachable freed (mark-and-sweep).
- Leaks: references kept unintentionally.
- Common: global variables, event listeners, timers, closures, detached DOM, caches.
- Cleanup on unmount.
- Heap snapshots to diagnose.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.