Web Development Deck Flashcards

1
Q

Where do you put non-visible content about the HTML document?

A

In the head element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where do you put visible content about the HTML document?

A

In the body element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Where do the head and body element tags go in a valid HTML document?

A

In between the html element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the purpose of a !DOCTYPE declaration?

A

It lets the web browser know what version of HTML it is running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Give five examples of HTML element types.

A
  1. head
  2. body
  3. p
  4. img
  5. html
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the purpose of HTML attributes?

A

HTML attributes provide additional information about the contents of an element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Give an example of an HTML entity (escape character).

A

© - copyright

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do block-level elements affect the document flow?

A

They are structural markups that always starts on a new line. Any content on the left or right side gets pushed up or down

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do inline elements affect the document flow?

A

They are semantic markups that provide extra information and does not disrupt the document flow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the default width and height of a block-level element?

A

The height is dictated by the content and the width takes up 100% of is parent container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the default width and height of an inline element?

A

Width and height are dictated by its content

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the difference between an ordered list and an unordered list in HTML?

A

An ordered list uses numbers to indicate a list of steps, but an unordered list uses bullet points to display a list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Is an HTML list a block element or an inline element?

A

Block element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What HTML tag is used to link to another website?

A

An a tag with attribute href=”(website URL)”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is an absolute URL?

A

The full web address used when linking to a different website

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a relative URL?

A

a shorthand used when linking to another page within the same site

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How do you indicate the relative link to parent directory?

A

../

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How do you indicate the relative link to a child directory?

A

directory name and file name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How do you indicate the relative link to a grand parent directory?

A

../../

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How do you indicate the relative link to the same directory?

A

Just the file name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the purpose of an HTML form element?

A

HTML forms gives you a set of elements to collect data from your users

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Give five examples of form control elements.

A

textarea, option, select, button, label

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Give three examples of type attributes values for HTML input elements.

A

text, radio, checkbox

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Is an HTML input element a block element or inline element?

A

It is neither

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are the primary HTML elements for creating tables?

A

table, tr, td, th, thead, tbody, tfoot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What purpose do the thead and tbody elements serve?

A

They help distinguish the heading from the body of the table. Also allows you to style these sections in different manner than the rest of the table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Give two examples of data that would lend itself well to being displayed in a table.

A

financial reports and tv schedules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What are the name of the individual pieces of a CSS ruleset?

A

A selector (indicates which element the rule applies to) and a declaration (indicates how the elements referred to should be styled)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

In CSS, how do you select elements by their class attributes?

A

A class selector use a period followed by the attribute value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

In CSS, how do you select elements by their tag name?

A

Use the element name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

In CSS, how do you select an element by its id attribute?

A

An id selector uses a # followed by the attribute value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Name three different types of values you can specify colors in CSS.

A

RGB values, Hex code, and Color names

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What CSS properties make up the box model?

A

Border, margin, padding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Which CSS properties pushes boxes away from each other?

A

Margin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

Which CSS property add space between a box’s content and its border?

A

Padding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What is a pseudo-class?

A

A pseudo-class is a selector that selects elements that are in a specific state, e.g. they are the first element of their type, or they are being hovered over by the mouse pointer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

What are CSS pseudo-classes useful for?

A

To make stylistic changes to user feedback

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

Name two types of units that can be used to adjust font-size in CSS.

A

rem and px

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

What CSS property controls the font used for the text inside an element?

A

font-size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

What is the default flex-direction of a flex container?

A

row

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

What is the default flex-wrap of a flex container?

A

nowrap

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

Why do two div elements “vertically stack” on one another by default?

A

Because they are block elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

What is the default flex-direction of an element with display: flex?

A

row

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

What is the default value for the position property of HTML elements?

A

static

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

How does setting position: relative on an element affect document flow?

A

It doesn’t affect document flow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

How does setting position: relative on an element affect where it appears in the page?

A

Relative positioning moves an element in relation to where it would have been in normal flow.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

How does setting position: absolute on an element affect document flow?

A

It get removed from document flow and all other elements fill the space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

how does setting position: absolute on an elements affect where it appears on the page?

A

Absolutely element no longer exists in the normal document flow. Instead, it sits on its own layer separate from everything else.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

How do you constrain an absolutely positioned elements to a containing block?

A

By looking for the parents container and setting it’s position to relative

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

What are the four box offset properties?

A

top, right, bottom, left

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

what is the purpose of variables?

A

a variable stores the data value that can used and changed later on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

How do you declare a variable?

A

specify the type, leave at least one space, then the name for the variable and end the line with a semicolon ( ; )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

How do you initialize (assign a value to) a variable?

A

add an equal sign (=) to the right of a variable name. to the right of the equal sign, write an expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

What characters are allowed in variable names?

A

letters, numbers, non-punctuation characters (except a period (.) is allowed, but cannot start with a number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

What does it mean to say that variable names are “case sensitive”?

A

This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

What is the purpose of a string?

A

A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

What is the purpose of a number?

A

Number is a primitive wrapper object used to represent and manipulate mathematical operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

What is the purpose of a boolean?

A

Boolean refers to a system of logical thought that is used to create true/false statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

What does the = operator mean in JavaScript?

A

an operator is a special symbol used to perform operations on operands (values and variables)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

How do you update the value of a variable?

A

We can update our variables in shorter ways by using the += , *= , -= or /= operators. No keyword needed, variable = value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

What is the difference between null and undefined?

A

undefined is a variable that refers to something that doesn’t exist, and the variable isn’t defined to be anything. null is a variable that is defined but is missing a value. Null is used to assign nothing to a variable purposefully. Undefined is JavaScripts response to nothing being assigned to the variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

Why is it a good habit to include “labels” when you log values to the browser console?

A

It helps organize which variables are being logged and in what order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

Give five examples of JavaScript primitives.

A

undefined , null , boolean , string and number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q

What data type is returned by an arithmetic operation?

A

An arithmetic operation combines two or more numeric expressions using the Arithmetic Operators to form a resulting numeric expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q

What is string concatenation?

A

the process of appending one string to the end of another string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q

What purpose(s) does the + plus operator serve in JavaScript?

A

returns the sum of the expression and concatenates strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q

What data type is returned by comparing two values (<, >, ===, etc)?

A

returns the boolean values: true of false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
68
Q

What does the += “plus-equals” operator do?

A

adds the value on the right, to the variable on the left, and then assigns that value back into the variable on the left

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
Q

What are objects used for?

A

Used to group a collection of key-value pairs into one variable object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q

What are object properties?

A

Variables that are part of an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
71
Q

Describe object literal notation.

A

an array of key-value pairs, with a colon separating the keys and values, and a comma after every key-value pair, except for the last

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q

How do you remove a property from an object?

A

Use the delete operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q

What are two ways to get or update the value of a property?

A

dot notation and bracket notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
74
Q

What are arrays used for?

A

to store a list of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
75
Q

Describe array literal notation.

A

values are separated by a comma in a bracket [ ] and then assigned to a variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q

How are arrays different from “plain” object?

A

arrays have a length property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q

What number represents the first index of an array?

A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
78
Q

What is the length property of an array?

A

tells you how many items you have in an array

79
Q

How do you calculate the last index of an array?

A

subtract the array length by 1 then index the array by that value

80
Q

What is a function in JavaScript?

A

a set of statements that performs a task or calculates a value that can be replicated multiple times

81
Q

Describe the parts of a function definition.

A

function keyword, optional name, comma-separated list of zero or more parameters surrounded by parentheses, start of the function’s code block, optional return statement,
end of the function’s code block

82
Q

Describe the parts of a function call.

A

function’s name, a comma separated list of zero or more arguments surrounded by parentheses

83
Q

When comparing them side-by-side, what are the differences between a function call and a function definition

A

function definition has a function keyword, parameters, and a code bock. function calls have arguments and returns a value

84
Q

What is the difference between a parameter and an argument?

A

a parameter is the variable in a function definition that has no value and is just a placeholder and an argument is the value passed when calling a function

85
Q

Why are function parameters useful?

A

so that the function can be used multiple times with a variety of different values

86
Q

What two effects does a return statement have on the behavior of a function?

A

causes the function to produce a value we can use in our program and prevents any more code in the function’s code block from being run

87
Q

Why do log things to the console?

A

console.log is a good debugging tool to check the progress of our code and see how things will appear in the browser

88
Q

What is a method?

A

a function that is a stored into the property of an object

89
Q

How is a method different from any other function?

A

includes an object that you are using the method from

90
Q

How do you remove the last element from an array?

A

.pop( ) method

91
Q

How do you round a number down to the nearest integer?

A

Math.floor( ) method - always goes down. Math.trunc( ) - take off the decimal

92
Q

How do you generate a random number?

A

Math.random( ) method - function returns a floating-point, pseudo-random number in the range 0 to less than 1 (inclusive of 0, but not 1)

93
Q

How do you delete an element from an array?

A

.splice( ) method - specifies a spot where you should delete

94
Q

How do you append an element to an array?

A

.push( ) method

95
Q

How do you break a string up into an array?

A

.split( ) method - takes an argument of a string and finds those values and breaks up the string at those locations

96
Q

Do string methods change the original string? How would you check if you weren’t sure?

A

They do not change the original string. When in doubt test it out

97
Q

Roughly how many string methods are there according to the MDN Web docs?

A

50

98
Q

Is the return value of a function or method useful in every situation?

A

It is potentially useful but not always

99
Q

Roughly how many array methods are there according to the MDN Web docs?

A

A lot

100
Q

What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?

A

MDN

101
Q

Give 6 examples of comparison operators.

A

==, !==, >, <, ===, >=

102
Q

What data type do comparison expressions evaluate to?

A

boolean values

103
Q

What is the purpose of an if statement?

A

it is a conditional statement that determines which lines of code should be run next based on the return value of the expression

104
Q

Is else required in order to use an if statement?

A

no

105
Q

Describe the syntax (structure) of an if statement.

A

if keyword, condition within parentheses( ), open curly brace, code to execute if the value is true, semi-colon, end curly brace

106
Q

What are the three logical operators?

A

&&, ||, !

107
Q

How do you compare two different expressions in the same condition?

A

separate the two expressions with a logical operator

108
Q

What is the purpose of a loop?

A

It allows you to execute a block of code multiple times as long as a specified condition is true

109
Q

What is the purpose of a condition expression in a loop?

A

Sets a stop for when the code should stop running

110
Q

What does “iteration” mean in the context of loops?

A

each single pass through the sequence to complete all steps in the given order

111
Q

When does the condition expression of a while loop get evaluated?

A

before the code block run before each iteration

112
Q

When does the initialization expression of a for loop get evaluated?

A

before the very first iteration of the code block

113
Q

When does the condition expression of a for loop get evaluated?

A

right before the code block and right after the final expression

114
Q

When does the final expression of a for loop get evaluated?

A

at the end of each iteration

115
Q

Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?

A

break keyword

116
Q

What does the ++ increment operator do?

A

it adds one to the variable

117
Q

How do you iterate through the keys of an object?

A

for in loop

118
Q

What are the four components of “the Cascade”.

A

source order, inheritance, specificity, and importance

119
Q

What does the term “source order” mean with respect to CSS?

A

code that falls lower in the stylesheet is stronger than those higher on the stylesheet

120
Q

How is it possible for the styles of an element to be applied to its children as well without an addition CSS rule?

A

inheritance process

121
Q

List three selector types in order of increasing specificity.

A

element type, class, then id

122
Q

Why is using !important considered bad practice?

A

it breaks the rules of the cascade

123
Q

What does the transforms property do?

A

it modifies the coordinate space of the CSS visual formatting model

124
Q

Give four examples of CSS transform functions.

A

rotate, scale, skew, translate

125
Q

The transition property is shorthand for which four CSS properties?

A

transition-property, transition-duration, transition-timing-function, and transition-delay

126
Q

Why do we log things to the console?

A

use as a debugger tool to check if our code is running the way it’s intended to

127
Q

What is a “model”?

A

a recreation of something

128
Q

Which “document” is being referred to in the phrase Document Object Model?

A

HTML document

129
Q

What is the word “object” referring to in the phrase Document Object Model?

A

JavaScript object (that is modeling the HTML document)

130
Q

What is a DOM tree?

A

structure wherein each node is an object representing a part of the document. The DOM represents a document with a logical tree

131
Q

Give two examples of document methods that retrieve a single element from the DOM.

A

querySelector( ) and getElementById( )

132
Q

Give on example of a document method that retrieves multiple elements from the DOM at once.

A

querySelectorAll( )

133
Q

Why might you want to assign the return value of a DOM query to a variable?

A

This saves the browser looking though the DOM tree to find the same element(s) again. It is known as catching the selection

134
Q

What console method allows you to inspect the properties of a DOM element object?

A

console.dir( )

135
Q

Why would a script tag need to be placed at the bottom of the HTML content instead of at the top?

A

So that the browser loads the HTML document before the javascript code

136
Q

What does document.querySelector( ) take as its argument and what does it return?

A

returns the first Element within the document that matches the specified selector, or group of selectors

137
Q

What does document.querySelectorAll( ) take as its argument and what does it return?

A

returns a static (not live) NodeList representing a list of the document’s elements that match the specified group of selectors

138
Q

What is the purpose of events and event handling?

A

events are actions that happen in the system which then tells you so that your code can react to them. Programmers can create event handler code that will run when an event fires, allowing web pages to respond appropriately to change

139
Q

Are all possible parameters required to use a JavaScript method of function?

A

no

140
Q

What method of element objects lets you run a function to be called when a specific type of event occurs?

A

addEventListener( )

141
Q

What is a callback function?

A

a function being passed to another function as an argument

142
Q

What object is passed into an event listener callback when the event fires?

A

event object

143
Q

What is the event.target?

A

Property whose value is where the element of this event occurs at, not where the listener was applied to

144
Q

What is the difference between these two snippets of code?

element.addEventListener(‘click’, handleClick)

element.addEventListener(‘click’, handleClick( ))

A

first one has a callback function that can be used later. Second one has a function that passes the return value of the function

145
Q

What is the className property of element objects?

A

it gets and sets the value of the class attribute of the specified html element

146
Q

How do you update the CSS class attribute of an element using JavaScript?

A

the element. classname = string of the class value

147
Q

What is the textContent property of element objects?

A

it returns the text content of the element and all descendaces, with spacing and CSS hidden text, but without the tag.

148
Q

How do you update the text within an elements using JavaScript?

A

element.textContent = ‘string’

149
Q

Is the event parameter of an event listener callback always useful?

A

Most of the time yes, but there are some specific cases where it is not needed

150
Q

Would this assignment be simper or more complicated if we didn’t use a variable to keep track of the number of clicks?

A

it would be more complicated because we wouldn’t have a variable to keep track of the value of the clicks

151
Q

Why is storing information about a program in variables better than only storing it in the DOM?

A

storing in a variable allows you to access to a location that is easy to refer back to, rather than writing coding that looks through the entire node tree everything you need access to a value

152
Q

What event is fired when a user places their cursor in a form control?

A

pointer event

153
Q

What event is fired when a user’s cursor leaves a form control?

A

blur event

154
Q

What event is fired as a user changes the value of a form control?

A

input event

155
Q

What event is fired when a user clicks the “submit” button within a ?

A

submit event - even on the form element not the submit button

156
Q

What does the event.preventDefault() method do?

A

it prevents the default action of an event

157
Q

What does submitting a form without event.preventDefault() do?

A

it refreshes the page before the data is stored

158
Q

What property of a form element object contains all of the form’s controls.

A

elements

159
Q

What property of a form control object gets and sets its value?

A

every form control should include a name attribute

160
Q

What is one risk of writing a lot of code without checking to see if it works so far?

A

it’ll be hard to find the location of a bug within your lines of code

161
Q

What is an advantage of having your console open when writing a JavaScript program?

A

it notifies you if you run into any bugs while you are working on code

162
Q

Does the document.createElement() method insert a new element into the page?

A

no, it just creates it

163
Q

How do you add an element as a child to another element?

A

appendChild( ) method

164
Q

What do you pass as the arguments to the element.setAttribute() method?

A

it becomes a string

165
Q

What steps do you need to take in order to insert a new element into the page?

A

create element, add config work if necessary, and append it using appendChild( ) method

166
Q

What is the textContent property of an element object for?

A

used to add text content to an element or retrieve the text content

167
Q

Name two ways to set the class attribute of a DOM element.

A

using the setAttribute method or the className property

168
Q

What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?

A

The function an be reused and the value of the return can also be returned

169
Q

Give two examples of media features that you can query in an @media rule.

A

min-width, min-height

170
Q

Which HTML meta tag is used in mobile-responsive web pages?

A

viewpoint metatag

171
Q

What is the event.target?

A

It is the target property of the event to the object which the even event was dispatched

172
Q

Why is it possible to listen for events on one element that actually happen its descendent elements?

A

event bubbling

173
Q

What DOM element property tells you what type of element it is?

A

tagName property

174
Q

What does the element.closest() method take as its argument and what does it return?

A

takes css selectors in string form and returns the first ancestor of the selected element

175
Q

How can you remove an element from the DOM?

A

remove method

176
Q

If you wanted to insert new clickable DOM elements into the page using JavaScript, how could you avoid adding an event listener to every new element individually?

A

event delegation

177
Q

What is the affect of setting an element to display: none?

A

it removes the element from the document flow

178
Q

What does the element.matches() method take as an argument and what does it return?

A

it takes a css selector in string form and returns a boolean value

179
Q

How can you retrieve the value of an element’s attribute?

A

getAttribute method

180
Q

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?

A

you would have to write multiple codes in javascript for the other views and tabs

181
Q

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?

A

you would need a bunch of different if statements

182
Q

What is a breakpoint in responsive Web design?

A

the point at which a website’s content and design will adapt in a certain way in order to provide the best possible user experience

183
Q

What is the advantage of using a percentage (e.g. 50%) width instead of a fixed (e.g. px) width for a “column” class in a responsive layout?

A

it moves based on the size of the window size

184
Q

If you introduce CSS rules for a smaller min-width after the styles for a larger min-width in your style sheet, the CSS rules for the smaller min-width will “win”. Why is that?

A

because of the source order or the cascade

185
Q

What is JSON?

A

text-based data format for representing structured data based on JavaScript object syntax

186
Q

What are serialization and deserialization?

A

serialization is the process of turning an object into a stream of bytes to be transported or stored. Deserialization is the opposite

187
Q

Why are serialization and deserialization useful?

A

used to send data - converts data into strings which are easily interpreted across all logic languages

188
Q

How do you serialize a data structure into a JSON string using JavaScript?

A

JSON.stringify( )

189
Q

How do you serialize a JSON into a data structure using JavaScript?

A

JSON.parse( )

190
Q

How do you store data in localStorage?

A

use the setItem( ) method on the localStorage object

191
Q

How do you retrieve data from localStorage?

A

use the getItem( ) method on the localStorage object

192
Q

What data type can localStorage save in the browser?

A

strings

193
Q

When does the ‘beforeunload’ event fire on the window object?

A

the event us fired when the window, the document, and its resources are about to be unloaded