Q20: What is Event Delegation and why is it useful?

Event Delegation is a pattern where a single event listener is attached to a parent element to manage events for all its present and future child elements by leveraging event bubbling and checking event.target.

Key Takeaways
  • Reduces memory overhead by minimizing total event listener count.
  • Handles dynamically inserted child elements without requiring new listener attachments.
Knowledge Check

Which event property points to the actual element that triggered the event?