DOM Events Flashcards
Why do we log things to the console?
method for developers to write code to inconspicuously inform the developers what the code is doing
What is the purpose of events and event handling?
Events are signals fired inside the browser window that notify of changes in the browser or operating system environment
Are all possible parameters required to use a JavaScript method or function?
not all possible parameters are needed
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?
callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.
What object is passed into an event listener callback when the event fires?
The event object is passed through.
What is the event.target? If you weren’t sure, how would you check? Where could you get more information about it?
The event.target is the specific element we clicked on. is the console.log(). look it up on mdm
What is the difference between these two snippets of code?
element.addEventListener(‘click’, handleClick)
element.addEventListener(‘click’, handleClick())
first is being called as a calledback function so it just waits to be loaded
second one is being called immediately so it just fires as soon as the page loads.