JS Flashcards
What is the className property of element objects?
Property holding the class attribute of that element
How do you update the CSS class attribute of an element using JavaScript?
object name.class name
What is the textContent property of element objects?
The text containing the element and it’s children
How do you update the text within an element using JavaScript?
objectname.text content
Is the event parameter of an event listener callback always useful?
not always
Would this assignment be simpler or more complicated if we didn’t use a variable to keep track of the number of clicks?
more difficult
Why is storing information about a program in variables better than only storing it in the DOM?
it’s more work for the browser
Why do we log things to the console?
to check for errors
What is the purpose of events and event handling?
so that developers would scan response
What do [] square brackets mean in function and method syntax documentation?
denotes that it’s optional can be provided or not
What method of element objects lets you set up a function to be called when a specific type of event occurs?
add event listener
What is a callback function?
function within a function
What object is passed into an event listener callback when the event fires?
a huge object when the event is passed containing all the info
What is the event.target? If you weren’t sure, how would you check? Where could you get more information about it?
element target which event originated from
What is a “model”?
a represenation of something