In javascript you can interact with users by creating and executing events.
Events are triggered in the browser when something happens such as mouse click or movement and keyboard interaction.
load
is an event that fires when a page is first loaded.
click
is another event, which happens when a user clicks something.
These events need to be attached to DOM elements to be executed. For example to execute a function when a link(hyperlink) is clicked, the event click
should be attached to the link
This model referred to as event-driven JavaScript.