DOM Flashcards
Why do we log things to the console?
To see easily and more directly the code whenever I check or fix it.
What is a “model”?
It contains interactive data
Which “document” is being referred to in the phrase Document Object Model?
HTML.
What is the word “object” referring to in the phrase Document Object Model?
It referring to the JavaScript language.
Give two examples of document methods that retrieve a single element from the DOM.
querySelector and getDocumentByID.
Give one example of a document method that retrieves multiple elements from the DOM at once.
querySelectorAll
Why might you want to assign the return value of a DOM query to a variable?
It reduces the computer’s work.
What console method allows you to inspect the properties of a DOM element object?
dir (directory).
Why would a script tag need to be placed at the bottom of the HTML content instead of at the top?
Because of the source order.
What does document.querySelector() take as its argument and what does it return?
It takes an element, class, id, etc’s name and it returns their values.
What does document.querySelectorAll() take as its argument and what does it return?
It takes an element, class, id, etc’s name and it returns all of their values under the same name tag.
What is the purpose of events and event handling?
To handle and verify inputs and actions (user input, user actions, and browser actions).
What do [] square brackets mean in function and method syntax documentation?
It’s optional. But the type and listener must be there.
What method of element objects lets you set up a function to be called when a specific type of event occurs?
EventTarget method addEventListener().
What is a callback function?
It’s a function passed to another function as an argument.