Now that we have a handler written and ready to go, we need to wire things up so the browser knows there’s a function it should invoke when the load event occurs. To do that we use the onload property of the window object, like this:
That’s it! Now, with this code written, we can sit back and know that the browser will invoke the function
How does the function created as an "event handler" handle the event? A tip: the even in this code is a property of an object. Once the object has been created and the property exists, the function/event handler is assigned to the property.