What's the difference between event bubbling and capturing?
Quick answer
Capturing goes top-down (window → target); bubbling goes bottom-up (target → window). Handlers run in the bubble phase by default.
In detail
An event travels down through ancestors (capture phase), reaches the target, then bubbles back up. By default `addEventListener` listens in the bubbling phase; pass `{ capture: true }` to listen on the way down. Bubbling is what makes event delegation possible.
parent.addEventListener("click", h); // bubble (default)
parent.addEventListener("click", h, { capture: true }); // captureWhy interviewers ask this: Core DOM knowledge for any front-end role.
Common follow-up questions
- →What is event delegation?
This is 1 of 118+ questions in the JavaScript Interview Kit
Get every question with detailed answers, follow-ups and real code — plus coding challenges and a last-minute revision sheet. One-time payment, instant access.
⚡ Get the JavaScript Interview Kit → ₹299