DOM Flashcards
Why do we log things to the console?
To check and debug code.
What is the purpose of events and event handling?
To respond to events in the system that is being programmed.
What do square brackets mean in function and method syntax documentation?
Square brackets in function and method syntax documentation means that the indicated arguments are optional.
What method of element objects lets you set up a function to be called when a specific type of event occurs?
The addEventListener() method.
What is a callback function?
A function passed as an argument to another function.
What object is passed into an event listener callback when the event fires?
An object based on Event describing the event that has occurred.
What is the event.target?
The target property gets the element on which the event originally occurred
Why do we log things to the console?
Logging things to the console tells us what the code is doing.
What is a “model”?
The model makes up the DOM and is made up of objects.
Which “document” is being referred to in the phrase Document Object Model?
The HTML document.
What is the word “object” referring to in the phrase Document Object Model?
The Window object.
What is a DOM tree?
The DOM Model is made up of a tree of objects.
Why might you want to assign the return value of a DOM query to a variable?
To store the location of elements within a DOM tree.
What console method allows you to inspect the properties of a DOM element object?
The dir method of the console object.
Why would a script tag need to be placed at the bottom of the HTML content instead of at the top?
Script tags are placed at the bottom of the HTML page because the browser needs to parse all of the elements before the JavaScript code can access them.