dom-events Flashcards
Why do we log things to the console?
checking functionality and check data; test code and debug
What is the purpose of events and event handling?
to trigger a function; make the page feel more interactive
What do [] square brackets mean in function and method syntax documentation?
it means that it is optional
What method of element objects lets you set up a function to be called when a specific type of event occurs?
addEventListener method
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?
a reference to the value of the object onto which the event was dispatched. check with MDN
What is the difference between these two snippets of code?
element. addEventListener(‘click’, handleClick)
element. addEventListener(‘click’, handleClick())
the latter code will call the function immediately
what is a callback function?
a function being called into another function as an argument