javascript-view-swapping Flashcards
What is the affect of setting an element to display: none?
The affect of setting an element to display: none is that it is no longer in the document flow and no longer visible.
What does the element.matches() method take as an argument and what does it return?
The element.matches() method takes a css selector as an argument and returns the boolean value true if the element has that selector and false if it does not.
How can you retrieve the value of an element’s attribute?
To retrieve the value of an element’s attribute call the method getAttribute(attribute name) with the attribute name as the argument and it returns the value of that element’s attribute.
At what steps of the solution would it be helpful to log things to the console?
Each step of the way during the programming of anything you should console.log.
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?
To add things in without using event delegation would require new event listeners and event handlers for those new tabs.
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?
Without a loop, addEventListeners would need to be applied to each tab instead of to the tab container.