dom-events Flashcards
Why do we log things to the console?
To check code and for debugging
What is the purpose of events and event handling?
an event is an action that occurs as a result of the user or another source, such as a mouse click. An event handler is a routine that deals with the event
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
What is the event.target? If you weren’t sure, how would you check? Where could you get more information about it?
The EventTarget interface is implemented by objects that can receive events and may have listeners for them, You could go to MDN
What is the difference between these two snippets of code?
element. addEventListener(‘click’, handleClick)
element. addEventListener(‘click’, handleClick())
One is the function definition and one is calling the function