DOM Events Flashcards
Why do we log things to the console?
To test our code
What is the purpose of events and event handling?
for user interaction
What do [] square brackets mean in function and method syntax documentation?
It means that it’s optional
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
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 target property of the Event interface is a reference to the object onto which the event takes place
debugger or documentation
MDN
What is the difference between these two snippets of code?
element. addEventListener(‘click’, handleClick)
element. addEventListener(‘click’, handleClick())
The first is a call back function