dom-events Flashcards
Why do we log things to the console?
for tracking and debugging purposes
What is the purpose of events and event handling?
to trigger events when specific events occur
Are all possible parameters required to use a JavaScript method or function?
no, a function can be called with less arguments than parameters.
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 is stored in an argument as data, waiting to be called
What object is passed into an event listener callback function 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?
a reference on the target to which the target was dispatched.
its not the element you applied the eventlistener to, its the element that was interacted with that caused the event to occur
What is the difference between these two snippets of code? hi() or (‘click’, hi)
the first is a callback function, the second one is not a callback because the function is actually being called then and there