JavaScript View Swapping Flashcards
What is the event.target?
The target property of the event interface is a reference to the object onto which the event was dispatched
The element where the event was dispatched
What is the affect of setting an element to display: none?
This key value pair will hide the targeted css selector
What does the element.matches() method take as an argument and what does it return?
The class attribute and it returns the attributes value
The CSS Selector matches the element
How can you retrieve the value of an element’s attribute?
// div Hi Champ! /div // const div1 = document.getElementById('div1') // returns div Hi Champ! /div // const exAttr = div1.getAttribute('id') // return 'div1'
element.getAttribute();
At what steps of the solution would it be helpful to log things to the console?
Every step
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?
You would have an event listener to the .tab querySelector
You would have a lot more conditionals
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?
You would have a lot of if statements
Each class for each tab would have to be unique