An event is the browser’s way of saying, “This thing happened!”
You can listen to these events by adding an event handler to the element.
Adding an event handler is your way of telling JavaScript, “If this event happens on this element, call this function.”

For example, in this demo, if the selected event happens on the bulb, the power function, switchBulb(), will be called to turn on/off the bulb.


Mouse Events Keyboard Events