For all the events you’ve seen, to wire up a handler, you’ve always assigned the handler to some property, like
onclick. But not all events work like this—for example, with time-based events, rather than assigning a handler to a property, you call a function,
setTimeout, instead and pass it your handler.
Here’s an example: say you want your code to wait five seconds before doing something. Here’s how you do that using
setTimeout and a handler:
How could other events be handled?