What is event delegation in JavaScript and how does it work?
Instruction: Describe the process and benefits of using event delegation in JavaScript event handling.
Context: This question is designed to assess the candidate's understanding of event handling in the DOM and the use of event delegation to manage events efficiently.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Event delegation puts a listener on a stable ancestor and routes events from its descendants. For a bubbling event such as click, it can cover matching children added later without installing a listener on each child.
This browser helper handles native buttons inside one container...