Quiz

Why would you use something like the `load` event?

Does this event have disadvantages? Do you know any alternatives, and why would you use those?
Topics
Web APIsJavaScript
Edit on GitHub

The load event fires at the end of the document loading process. At this point, all of the objects in the document are in the DOM, and all the images, scripts, links and sub-frames have finished loading.

The DOM event DOMContentLoaded will fire after the DOM for the page has been constructed, but do not wait for other resources to finish loading. This is preferred in certain cases when you do not need the full page to be loaded before initializing.

Edit on GitHub