HTML Flashcards

1
Q

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

A

In the Head tag

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

Body tag

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

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

A

Inbetween and

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

What is the purpose of a declaration?

A

State the kind of document it is

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

Give five examples of HTML element tags.

A

h1 p br body h2

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

To define actions and parameters with in the elements.

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

&amp is used to create an ampersand.

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

Create sections for different content vertically

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

Create sections for different content horizontally

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

Default width is the view port. Default height is bound by the above and below block.

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 is bound my the neighboring inline elements. Height is defined by the space it content takes.

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

Number and bullet points

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. It creates a space that is effected by element below and above.

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

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

A

parent_dir/file.html

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

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

A

/child_dir

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

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

A

../dir/file.html

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

What is the purpose of an HTML form element?

A

“Input!”

-Number 5 from Shortcircuit

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

Give five examples of form control elements.

A

Form, input, select, textarea, button

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

Give three examples of type attributes for HTML elements.

A

phone, text. email

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

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

A

Inline, because it operates in horizontal space

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

What are the six primary HTML elements for creating tables?

A

thead, td, tr, tbody, th, tfoot

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

What purpose do the thead and tbody elements serve?

A

thead designates the top of the row for titles.

tbody contains all the data, rows, etc. of table

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

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

A

Financial information.

A restaurant menu.

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

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

A

Names, rbg, hex

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

What are the names of the individual pieces of a CSS rule?

A

Selector, property, value

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

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

A

Placing a period . in front of the selector

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

In CSS, how do you select elements by their type?

A

Naming the element

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

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

A

Placing a # in front of the selector word.

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

What CSS properties make up the box model?

A

Margin, padding, border

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

Which CSS property pushes boxes away from each other?

A

Margin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
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
32
Q

What is a pseudo-class?

A

An effect or state that can be added by the browser onto any html element with a colon :

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

What are CSS pseudo-classes useful for?

A

Creating an effect or state for an html element when the user gives some kind of input

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

Name at least two units of type size in CSS.

A

point and pixels

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

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

A

font-family

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

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

A

Horizontally

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
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
38
Q

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

A

They are a block element.

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

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

A

Horizontally

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

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

A

Horizontally

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

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

A

Everything moves around it but it moves.

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

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

A

It doesn’t. It just floats where ever it boundaries are or relative to the edge of the view port.

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

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

A

Everything moves around it.

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

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

A

It sits where ever css sets it.

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

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

A

Set the block to position: relative and it will with in those boundaries

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

What are the four box offset properties?

A

Relative, fixed, absolute, static.

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

What is the purpose of variables?

A

Storing values

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

How do you declare a variable?

A

var varName;

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

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

A

var varName = ‘some val’;

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

What characters are allowed in variable names?

A

A-Z, a-z, _, &, numbers (not for first character)

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

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

A

A-Z is different from a-z

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

What is the purpose of a string?

A

Store array of chars

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

What is the purpose of a number?

A

Math!

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

What is the purpose of a boolean?

A

true and false values

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

What does the = operator mean in JavaScript?

A

Assignment operator

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

How do you update the value of a variable?

A

Reassign it

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

What is the difference between null and undefined?

A

the former is assign to nothing, the later is not assigned

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

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

A

Know what the code is doing. Its the only way,

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

Give five examples of JavaScript primitives.

A

String, numbers, bool, null, undefined

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

What data type is returned by an arithmetic operation?

A

A number

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

What is string concatenation?

A

joining strings

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

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

A

Addition and concatenation

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

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

A

bool

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

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

A

Adds existing var value to another value

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

What are objects used for?

A

Storing data

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

What are object properties?

A

Item contained by object

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

Describe object literal notation.

A

{}

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

How do you remove a property from an object?

A

delete someObj.someProp

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

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

A

someObj.someProp

someObj[‘someProp’]

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

What are arrays used for?

A

Storing data that has no property

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

Describe array literal notation.

A

[]

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

How are arrays different from “plain” objects?

A

They have no properties corresponding to values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
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
74
Q

What is the length property of an array?

A

Returns how many items are in array

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

How do you calculate the last index of an array?

A

someArr.length - 1

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

What is a function in JavaScript?

A

Repeatable set of instrucitons

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

Describe the parts of a function definition.

A

func key word, name, parameters, code block, return statement

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

Describe the parts of a function call.

A

Name, arguments.

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

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

A

Making the code, recalling the made code to do something

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

What is the difference between a parameter and an argument?

A

Param: template to follow in call, Arg: data put into a call

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

Why are function parameters useful?

A

Setting out the kind of data that will go into the called function

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

Why do we log things to the console?

A

See what is happening in the code

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

What is a method?

A

Built in function callable on appropriate variables

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

How is a method different from any other function?

A

Its built in

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

How do you remove the last element from an array?

A

.pop

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

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

A

.floor

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

How do you generate a random number?

A

Math.random()

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

How do you delete an element from an array?

A

delete arr.someitem

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

How do you append an element to an array?

A

arr.push(someItem)

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

How do you break a string up into an array?

A

string.split(‘ ‘);

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

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

A

Yes. Console log the string

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

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

A

30ish

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

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

A

No

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

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

A

30ish

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

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

A

mdn

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

Give 6 examples of comparison operators.

A

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

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

What data type do comparison expressions evaluate to?

A

bool

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

What is the purpose of an if statement?

A

Making decisions

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

Is else required in order to use an if statement?

A

no

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

Describe the syntax (structure) of an if statement.

A

if(){

}

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

What are the three logical operators?

A

&& || !

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

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

A

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

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

What is the purpose of a loop?

A

Repeating work

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

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

A

See how the loop is repeated

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

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

A

The number that counts up to keep track of the loops progress.

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

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

A

the start

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

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

A

var i = 0;

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

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

A

;i < someVal

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

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

A

;i++)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
110
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;

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

What does the ++ increment operator do?

A

counts up by 1

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

How do you iterate through the keys of an object?

A

forEach?

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

What are the four components of “the Cascade”.

A

Find all declarations whose selectors match a particular element.
Sort these declarations by weight and origin.
Sort the selectors by specificity.
Sort by order specified.

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

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

A

Elements lower in the casade will take priority

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

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

A

inheritance

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

List the three selector types in order of increasing specificity.

A

element selectors, class selectors, id selectors

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

Why is using !important considered bad practice?

A

CSS blocks will be difficult to use on other pieces of code.

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

Why do we log things to the console?

A

To know what is happening in the code

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

What is a “model”?

A

Simplified representation

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

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

A

document variable

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

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

A

Nodes on the tree

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

What is a DOM Tree?

A

Nodes under the document, like <h1> so forth</h1>

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

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

A

.getByID .getByClassSelecotor

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

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

A

querySelectorAll()

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

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

A

To access properties later

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

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

A

console.dir()

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

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

A

To load HTML first

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

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

A

Gets first instance of selector. returns everything between the tags

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

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

A

Gets all elements matching args, returns everything between the tags

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

Why do we log things to the console?

A

To know what is going on in the code

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

What is the purpose of events and event handling?

A

Make changes dymanically

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

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

A

No, some are optionsal

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

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

A

event handleers?

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

What is a callback function?

A

Function that happens after an event handler

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

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

A

event object

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

What is the event.target? If you weren’t sure, how would you check? Where could you get more information about it?

A

console.log

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

What is the difference between these two snippets of code?

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

A

The first is loading it to be called on the event

The second one is calling the function right ways

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

What is the className property of element objects?

A

Renaming class name after selected by querySelector

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

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

A

reassign it with className

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

What is the textContent property of element objects?

A

Change all the text of an element

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

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

A

reassign using textContent

142
Q

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

A

yes

143
Q

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

A

The same

144
Q

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

A

Querying the dom takes alot of computer power.

145
Q

What does the transform property do?

A

Distort an element on x,y, and z axis

146
Q

Give four examples of CSS transform functions.

A

scale, rotate, translate, translate

147
Q

The transition property is shorthand for which four CSS properties?

A

transition-delay
transition-duration
transition-property
transition-timing-function

148
Q

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

A

focus

149
Q

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

A

unfocus

150
Q

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

A

input

151
Q

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

A

submit

152
Q

What does the event.preventDefault() method do?

A

prevents the default action is stopped

153
Q

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

A

Sends data with get

154
Q

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

A

Elements property

155
Q

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

A

Naming elements by name

156
Q

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

A

It not working and having to rewrite it

157
Q

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

A

Remembering to test code

158
Q

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

A

no

159
Q

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

A

.childAppend()

160
Q

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

A

arg name of attr, arg value of attr

161
Q

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

A

querySelector() childAppend()

162
Q

What is the textContent property of an element object for?

A

Adding text

163
Q

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

A

.className = ‘whatEverClass’ .setAttribute()

164
Q

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

A

Reusablity

165
Q

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

A

Screen, braile

166
Q

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

A

viewport meta tag

167
Q

What is the event.target?

A

array of element

168
Q

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

A

Using closest()

169
Q

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

A

tag make

170
Q

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

A

selector. Returns the dom tree

171
Q

How can you remove an element from the DOM?

A

remove()

172
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

Attach event listener to parent

173
Q

What is the event.target?

A

The object of the thing in play

174
Q

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

A

idk

175
Q

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

A

.getAttribute(‘’)

176
Q

At what steps of the solution would it be helpful to log things to the console?

A

All of them

177
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

An event listener for every tab in the exereice. We had 3 tabs and we selected them all.

178
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

We had 3 tabs and we selected them all. And edit them in a indivudual code blocks

179
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

We had 3 tabs and we selected them all. And edit them in a individual code blocks

180
Q

What is JSON?

A

JavaScript Object Notation

181
Q

What are serialization and deserialization?

A

Serialized is human readable.

Deserialized is easier to store in the computer

182
Q

Why are serialization and deserialization useful?

A

S: means that we can work with the data easily
D: make it easy for the computer work with the data and then shoot it back to us

183
Q

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

A

.stringify()

184
Q

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

A

.parse()

185
Q

How to you store data in localStorage?

A

localStorage.setItem()

186
Q

How to you retrieve data from localStorage?

A

localStorage.getItem()

187
Q

What data type can localStorage save in the browser?

A

strings, numbers, bool

188
Q

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

A

Right before refresh.

189
Q

What is a method?

A

function attach to a class

190
Q

How can you tell the difference between a method definition and a method call?

A
Def: it just sits in the class
Call: making it alive
191
Q

Describe method definition syntax (structure).

A

Nested in an object

192
Q

Describe method call syntax (structure).

A

class.someMethod();

193
Q

How is a method different from any other function?

A

its attached to a class instead of free standing

194
Q

What is the defining characteristic of Object-Oriented Programming?

A

It attaches action/usefulness to data

195
Q

What are the four “principles” of Object-Oriented Programming?

A

Polymorphism, inhertience, abstraction, Encapsulation

196
Q

What is “abstraction”?

A

Making the complex simple

197
Q

What does API stand for?

A

Application Program Interface

198
Q

What is the purpose of an API?

A

Abstracting the systems complexity for simple communication with an outside system

199
Q

What is this in JavaScript?

A

place holder

200
Q

What does it mean to say that this is an “implicit parameter”?

A

Inserted for another item. Not called outright

201
Q

When is the value of this determined in a function; call time or definition time?

A

definition time

202
Q

How can you tell what the value of this will be for a particular function or method definition?

A

You can’t

203
Q

How can you tell what the value of this is for a particular function or method call?

A

Left of the dot

204
Q

What kind of inheritance does the JavaScript programming language use?

A

Prototypical

205
Q

What is a prototype in JavaScript?

A

Using existing objects that other ojbects can use as a jumping off point

206
Q

How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on objects, arrays, and numbers?

A

They inherited is from the prototype

207
Q

If an object does not have it’s own property or method by a given key, where does JavaScript look for it?

A

Prototype

208
Q

What does the new operator do?

A

Creates new instance

209
Q

What property of JavaScript functions can store shared behavior for instances created with new?

A

prototypical

210
Q

What does the instanceof operator do?

A

tests if var is instance of an object

211
Q

What is a “callback” function?

A

It doesn’t have () because it will be called later

212
Q

Besides adding an event listener callback function to an element or the document, what is one way to delay the execution of a JavaScript function until some point in the future?

A

setTImeout()

213
Q

How can you set up a function to be called repeatedly without using a loop?

A

Set counter outside of function and increment inside function

214
Q

What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?

A

0

215
Q

What do setTimeout() and setInterval() return?

A

IntervalId

216
Q

What is a client?

A

THe computer

217
Q

What is a server?

A

The tthing the computer is sending info to and from

218
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

get

219
Q

What three things are on the start-line of an HTTP request message?

A

Method / Protocol (http) / version 1.1

220
Q

What three things are on the start-line of an HTTP response message?

A

Protocol / version / status message (like 404 or 200)

221
Q

What are HTTP headers?

What are HTTP headers?

A

All the infos

222
Q

Where would you go if you wanted to learn more about a specific HTTP Header?

A

MDN

223
Q

Is a body required for a valid HTTP request or response message?

A

No

224
Q

What is AJAX?

A

Tool that makes js async and enables api calls

225
Q

What does the AJAX acronym stand for?

A

Async Json And Xml

226
Q

Which object is built into the browser for making HTTP requests in JavaScript?

A

XMLHttprequest()

227
Q

What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?

A

load event

228
Q

Bonus Question: An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?

A

Both are branching off of a prototype somewhere up stream

229
Q

What is a code block? What are some examples of a code block?

A

Stuff betwee { }

230
Q

What does block scope mean?

A

Things only exist inbetween { }

231
Q

What is the scope of a variable declared with const or let?

A

Block scope

232
Q

What is the difference between let and const?

A

let is mutable, const is immutable.

233
Q

Why is it possible to .push() a new value into a const variable that points to an Array?

A

Arrays are mutable over riding the nature of const

234
Q

How should you decide on which type of declaration to use?

A

Will the variable need to be reassigned later or how important is it that that var is immutable

235
Q

What is the syntax for writing a template literal?

A

` ` (backticks), ${someVar} (variables)

236
Q

What is “string interpolation”?

A

Slotting in a var like sometext ${somevar} more text

237
Q

What is destructuring, conceptually?

A

making arr and obj into variables

238
Q

What is the syntax for Object destructuring?

A

let {var1, var2, var3} = someOjb

239
Q

What is the syntax for Array destructuring?

A

let [var1, var2, var3 ] = someArr

240
Q

How can you tell the difference between destructuring and creating Object/Array literals?

A

For destructuring the obj/arr has already been created.

241
Q

What is the syntax for defining an arrow function?

A

() => {}

242
Q

When an arrow function’s body is left without curly braces, what changes in its functionality?

A

that data is returned

243
Q

How is the value of “this” determined within an arrow function?

A

At definition time.

244
Q

What is a CLI?

A

command line interface

245
Q

What is a GUI?

A

graphical user interface

246
Q

What are the three virtues of a great programmer?

A

Laziness, impatience, hubris

247
Q

What is Node.js?

A

JS on a computer (not a browser)

248
Q

What can Node.js be used for?

A

JS on the backend

249
Q

What is a REPL?

A

Read Eval Print loop

250
Q

When was Node.js created?

A

2009

251
Q

What back end languages have you heard of?

A

Python ruby node c c++ c# java php javascript

Perl Lisp Haskell Go Swift Rust Visual-Basic

252
Q

What back end languages have you heard of?

A

Python ruby c c++ c# java php javascript

Perl Lisp Haskell Go Swift Rust Visual-Basic

253
Q

What is a computer process?

A

Single program running your computer

254
Q

Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?

A

Like at least 100

255
Q

Why should a full stack Web developer know that computer processes exist?

A

Because code runs on computers

256
Q

What is the process object in a Node.js program?

A

Pulls things from operating system

257
Q

How do you access the process object in a Node.js program?

A

global

258
Q

What is the data type of process.argv in Node.js?

A

Array of strings

259
Q

What is a JavaScript module?

A

A single js file

260
Q

What values are passed into a Node.js module’s local scope?

A
exports
require
module
\_\_filename
\_\_dirname
261
Q

What is the purpose of module.exports in a Node.js module?

A

exporting code to another file

262
Q

How do you import functionality into a Node.js module from another Node.js module?

A

require()

263
Q

What is the JavaScript Event Loop?

A

Event queue, blocking operations, execute call back,

264
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A

blocking is synchronous, non-blocking is asynchronous

Blocking is code currently occupying the call stack

265
Q

What module does Node.js include for manipulating the file system?

A

fs

266
Q

What method is available in the Node.js fs module for writing data to a file?

A

fs.writeFile()

267
Q

Are file operations using the fs module synchronous or asynchronous?

A

both

268
Q

What is a client?

A

Initates communication

269
Q

What is a server?

A

Send response because it a recieved a request

270
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

Get

271
Q

What is on the first line of an HTTP request message?

A

request methods, destination, version number

272
Q

What is on the first line of an HTTP response message?

A

Method version, status code

273
Q

What are HTTP headers?

A

Meta information about website

274
Q

Is a body required for a valid HTTP message?

A

No

275
Q

What is NPM?

A

Node package manager

276
Q

What is a package?

A

library to extend functionality

277
Q

How can you create a package.json with npm?

A

npm init –yes

278
Q

What is a dependency and how to you add one to a package?

A

npm install

279
Q

What happens when you add a dependency to a package with npm?

A

It gets added to the package.json

280
Q

What Express application method starts the server and binds it to a network PORT?

A

open()

281
Q

How do you mount a middleware with an Express application?

A

app.method

282
Q

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

req, res

283
Q

What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?

A

JSON

284
Q

What is the significance of an HTTP request’s method?

A

Tells us and the program what is being done.

285
Q

What is PostgreSQL and what are some alternative relational databases?

A

MySQL

286
Q

What are some advantages of learning a relational database?

A

It works well in a lot of situtations. You can build anything you want and scale projects really big

287
Q

What is one way to see if PostgreSQL is running?

A

TOP

288
Q

What is a database schema?

A

Tables in a database and how they are organized.

289
Q

What is a table?

A

Grouping

290
Q

What is SQL and how is it different from languages like JavaScript?

A

No logic

291
Q

How do you retrieve specific columns from a database table?

A

select * from someTable

292
Q

How do you filter rows based on some specific criteria?

A

..where “someField” = ‘someVal’

293
Q

What are the benefits of formatting your SQL?

A

Constient style and readabliity

294
Q

What are four comparison operators that can be used in a where clause?

A

= < >

295
Q

How do you limit the number of rows returned in a result set?

A

limit 10

296
Q

What are four comparison operators that can be used in a where clause?

A

= < > !=

297
Q

How do you control the sort order of a result set?

A

… order by “someField” acs limit 10;

298
Q

What is a foreign key?

A

id field from table2 in table1

299
Q

How do you join two SQL tables?

A

select * from “someTable1”

join “someTable2” using (“someFeildInCommon”)

300
Q

How do you temporarily rename columns or tables in a SQL statement?

A

as

301
Q

How do you delete rows from a database table?

A

delete “someRow” from “someTable”

302
Q

How do you accidentally delete all rows from a table?

A

delete * from “someTable”

303
Q

How do you update rows in a database table?

A

update “someRow” from “someTable”

304
Q

Why is it important to include a where clause in your update statements?

A

To find exactly where you intend to update

305
Q

How do you add a row to a SQL table?

A

insert into “products” (“name”, “description”, “price”, “category”)
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’);

306
Q

What is a tuple?

A

The values to be inserted

insert into “products” (“name”, “description”, “price”, “category”)
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’);

307
Q

How do you add multiple rows to a SQL table at once?

A

insert into “products” (“name”, “description”, “price”, “category”)
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’),
(‘Tater Mitts’, ‘Scrub some taters!’, 6, ‘cooking’)
returning *;

308
Q

How do you get back the row being inserted into a table without a separate select statement?

A

returning *

309
Q

What are the three states a Promise can be in?

A

initial, fullfill, reject

310
Q

How do you handle the fulfillment of a Promise?

A

.then()

311
Q

How do you handle the rejection of a Promise?

A

.catch()

312
Q

What is Array.prototype.filter useful for?

A

Getting items without needing a loop

313
Q

What is “syntactic sugar”?

A

Makes it easier to read and write

314
Q

What is the typeof an ES6 class?

A

Object I think.

315
Q

Describe ES6 class syntax.

A
class SomeClass {
  somePrototypeMethod(){}
}

function looks like function SomeFunction{}

SomeFunction.prototype.somePrototypeMethod(){
}

316
Q

What is “refactoring”?

A

Changing it to be better. More reliable, readable, etc.

And to get rid of technical debt.

317
Q

What is Webpack?

A

It makes files accessible to one another through out the entire.

318
Q

How do you add a devDependency to a package?

A

npm install somePackage –save-dev

319
Q

What is an NPM script?

A

tells npm what to do like running webpack or a custom script

320
Q

How do you execute Webpack with npm run?

A

npm run build

321
Q

How are ES Modules different from CommonJS modules?

A

syntax
CommonJS is not part of javascript core.
ES-6 modules are part of the core.

322
Q

What kind of modules can Webpack support?

A

Both I think

323
Q

What is React?

A

A JS framework for creating webpages and funcitonality quickly

324
Q

What is a React element?

A

Created element similar to document.createElement()

325
Q

How do you mount a React element to the DOM?

A

ReactDOM.render()

326
Q

What is Babel?

A

JS compiler. Converts new JS to old JS

327
Q

What is a Plug-in?

A

Adds a specific functionality to extend bigger software

328
Q

What is a Webpack loader?

A

Intersects files before they get included in the module

329
Q

How can you make Babel and Webpack work together?

A

Babel loader

330
Q

What is JSX?

A

JavaScript Extension

331
Q

Why must the React object be imported when authoring JSX in a module?

A

Because react tries to stay as lightweight as possible

332
Q

How can you make Webpack and Babel work together to convert JSX into valid JavaScript?

A

IDK the build script

333
Q

What is a React component?

A

Can be called later with html style element

334
Q

How do you define a function component in React?

A

like a variable assigned to JSX

335
Q

How do you mount a component to the DOM?

A

Render or just call it

336
Q

What are props in React?

A

Properties passed through interitance

337
Q

How do you pass props to a component?

A
function SomFunc(props){
}
338
Q

How do you write JavaScript expressions in JSX?

A

Fill this in

339
Q

How do you create “class” component in React?

A
class SomeCla extends React.Component{
}
340
Q

How do you access props in a class component?

A

this.props.some

341
Q

What Array method is commonly used to create a list of React elements?

A

.map()

342
Q

What is the best value to use as a “key” prop when rendering lists?

A

.Id or number

343
Q

What does express.static() return?

A

Files and directories

344
Q

What is the local __dirname variable in a Node.js module?

A

Current directory

345
Q

What does the join() method of Node’s path module do?

A

Joins strings to browse the file structure

346
Q

What does fetch() return?

A

contents of a file

347
Q

What is the default request method used by fetch()?

A

get

348
Q

How do you specify the request method (GET, POST, etc.) when calling fetch?

A

Method key in the myInit object

349
Q

When does React call a component’s componentDidMount method?

A

After render

350
Q

Name three React.Component lifecycle methods.

A

render() componentDidMount() componentDidUpdate()

351
Q

How do you pass data to a child component?

A

Props like someProps={someInput}