JS View Swapping Flashcards
What does theelement.matches( )method take as an argument and what does it return?
Takes a selector as a string for an argument and returns a Boolean value
How can you retrieve the value of an element’s attribute?
getAttributes( ) method
At what steps of the solution would it be helpful to log things to the console?
Anytime you want to verify a value or to verify if the code is working correctly.
If you didn’t use a loop to conditionally show or hide the views in the page, how would your JavaScript code be written instead?
The code would have to have multiple conditions for each tab.
If you were to add another tab and view to your HTML, but you didn’t use event delegation, how would your JavaScript code be written instead?
Go back and add new event listener and possibly new event handler function for each tab.
What is theevent.target?
Element where the event occurs
What is the affect of setting an element todisplay: none?
The element won’t be displayed because it won’t get rendered. The document will treat it as if it didn’t exist along with child elements.