JavaScript card revieweasy

Explain event delegation in JavaScript and why we should use it.

Event delegation is a technique where instead of adding event listeners directly to multiple child elements, we attach a single event listener to their parent element. It works due to 'event bubbling' (events propagate upwards through the DOM tree). It saves memory, improves performance, and automatically handles dynamic elements added to the parent later.

JB

Jeevan Bhargav

Audited by Creator

This answer is calibrated for technical interviews. Verify benchmarks in local sandboxes before deploying.