An event handler is a callback registered as a listener on an event target; it runs when a matching event occurs. In interviews, handlers also provide a setting to reason about JavaScript scope and `this` binding. section 3.1 section 3.3
Listing 3.10 The click listener attached to the parent
document.getElementById('myList').addEventListener('click', function(e) {
if (e.target.tagName === 'LI') {
console.log(`You clicked: ${e.target.textContent}`);
}
});
A delegated click handler sits on the parent list, filters clicks to list items, and uses the event target to identify the clicked item. section 3.3




























