dom-events Flashcards
Why do we log things to the console?
Debugging, checking how things are working
What is the purpose of events and event handling?
Making a page interactive
Are all possible parameters required to use a JavaScript method or function?
no
What method of element objects lets you set up a function to be called when a specific type of event occurs?
addEventListener
What is a callback function?
A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.
What object is passed into an event listener callback when the event fires?
the event object which contains all information about that event
What is the event.target? If you weren’t sure, how would you check? Where could you get more information about it?
target property of event object is the point of interaction, (if you hover over an object, that would be the event.target).
What is the difference between these two snippets of code?
element. addEventListener(‘click’, handleClick)
element. addEventListener(‘click’, handleClick())