Namaste JavaScript — Interview Quick Notes
Ep 14: Callback Functions & Event Listeners
- JS is single-threaded but callbacks give access to asynchronous behaviour.
- Never block the main thread — use async APIs (setTimeout, fetch) for time-intensive work.
- Event listeners form closures over their scope — they are heavy (memory not freed until explicitly removed).
- Remove event listeners when no longer needed to allow garbage collection.