JavaScript Flashcards
What is the event.target?
where the event originated from
What is the affect of setting an element to display: none?
removed from the document flow
hides element
What does the element.matches() method take as an argument and what does it return?
How can you retrieve the value of an element’s attribute?
.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?
create separate event listeners for every tab
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?
create conditional block for each view
What is JSON?
text based data format for representing data based on JavaScript object syntax
What are serialization and deserialization?
process of converting an object into a stream of bytes to more easily save or transmit
constructing a data structure or object from a series of bytes
Why are serialization and deserialization useful?
makes it easier to save or transmit data
How do you serialize a data structure into a JSON string using JavaScript?
JSON.stringify() method
How do you deserialize a JSON string into a data structure using JavaScript?
JSON.parse() method
How do you store data in localStorage?
.setItem() method
(key name, value)
How do you retrieve data from localStorage?
.getItem() method
(key/property name)
What data type can localStorage save in the browser?
string data type
When does the ‘beforeunload’ event fire on the window object?
when user refreshes or exit window
How can you tell the difference between a method definition and a method call?
Describe method definition syntax (structure).