dom-events Flashcards
Why do we log things to the console?
For debugging properties
What is the purpose of events and event handling?
Events help determine how the user interacts with the web page. Event handling helps us create actions around their interactions.
What do [] square brackets mean in function and method syntax documentation?
Access properties or the index value of an array.
What method of element objects lets you set up a function to be called when a specific type of event occurs?
Event listener.
What is a callback function?
A function being passed as an argument to another function.
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?
It shows the target that the event occured on. console.log. the event object
What is the difference between these two snippets of code?
element. addEventListener(‘click’, handleClick)
element. addEventListener(‘click’, handleClick())
The latter’s callback function is being called immediately the event listener runs while the former is being passed to allow the element to determine when the function runs.