addEventListener() (JavaScript)

addEventListener() tells an element to run a function whenever a specific event happens, such as a click or keypress. It is the standard way to make pages…