DOM Events Flashcards
Why do we log things to the console?
To test and debug our code
What is the purpose of events and event handling?
It is useful in triggering code
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?
It is a function passed in as an argument for another function
What object is passed into an event listener callback when the event fires?
The event object
What is the event.targer? If you weren’t sure, how would you check? Where could you get more information about it?
The element that the event targeted
What is the difference between these two snippets of code?
element. addEventListener(‘click’, handleClick)
element. addEventListener(‘click’, handleClick())
The first is calling the function and the second is defining a new function