dom-events Flashcards
Why do we log things to the console?
Remove bugs and check functionality.
What is the purpose of events and event handling?
User interaction.
What do [ ] square brackets mean in function and method syntax documentation?
Optional values.
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 function that takes another function as parameter and is not called by us.
What object is passed into an event listener callback when the event fires?
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 is the elements that was interacted with. MDN.
What is the difference between these two snippets of code?
element. addEventListener(‘click’, handleClick);
element. addEventListener(‘click’, handleClick( ));
The first is a callback function.
The second it an anonymous function.