HTML Flashcards

(355 cards)

1
Q

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

A

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 head and body tags go in a valid HTML document?

A

html tag first
head tag second
body tag last

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

Informs the web browser about the type and version of HTML used in building the web document.

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

doctype html head body span ul li p a

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

Modifies the element type

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

&copy &reg

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

It takes up 100% of the width of the block line, and starts a new line.

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

It takes up only the smallest space that an element needs, continues on the same line.

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

100% width, height unchangeable

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 determined by the element, height is unchangeable

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

Ordered list has numbers for every li tag, unordered has bullet points, stars, etc.

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

<a>Anchor Tags</a> (Anchor tags)

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

What is an absolute URL?

A

URL that directs to an external site.

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

What is a relative URL?

A

URL that directs to a specific location inside a folder that is relative to the root you’re in.

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 a parent directory?

A

the (../)

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

calling the folder name, then the file inside the folder that you want to open

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

using (../../)

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

If it’s in the same directory, you just need to call the name of the file.

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

Collect information, and sending it back to the developer.

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

input label select textarea button legend

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

Give three examples of type attributes for HTML elements.

A

button checkbox radio text password file hidden submit

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

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

A

inline element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What are the six primary HTML elements for creating tables?
table thead tbody td tr tfoot
26
What purpose do the thead and tbody elements serve?
screen readers
27
Give two examples of data that would lend itself well to being displayed in a table.
statistics organizing data table
28
What are the names of the individual pieces of a CSS rule?
CSS Selector, declaration block
29
In CSS, how do you select elements by their class attribute?
add a (.) before the class name
30
In CSS, how do you select elements by their type?
Calling the element name by itself
31
In CSS, how do you select an element by its id attribute?
add a (#) before the name
32
What CSS properties make up the box model?
Margin Border Padding
33
Which CSS property pushes boxes away from each other?
Margin
34
Which CSS property add space between a box's content and its border?
Padding
35
Name three different types of values you can use to specify colors in CSS.
RGB, Hexcode, Color Names
36
What is a pseudo-class?
Selector that selects elements that are in a specific state eg hover, active, visited, etc.
37
What are CSS pseudo-classes useful for?
Add functional styles for the elements
38
What is the default flex-direction of a flex container?
row (horizontal)
39
What is the default flex-wrap of a flex container?
no-wrap (makes everything shrink and fit on one line)
40
Why do two div elements "vertically stack" on one another by default?
because of it having the property of display: block | which takes up the whole width and starts on a new line.
41
What is the default flex-direction of an element with display: flex?
flex-direction: row (horizontal)
42
What is the default value for the position property of HTML elements?
static
43
How does setting position: relative on an element affect document flow?
relative does not affect the positioning of elements in normal flow unless you add offsets, but does cause those elements to be considered to be positioned.
44
How does setting position: relative on an element affect where it appears on the page?
any adjustments you do to it is relative to where it is on the page
45
How does setting position: absolute on an element affect document flow?
moves it from the document flow
46
How does setting position: absolute on an element affect where it appears on the page?
attaches to any parent without a static element
47
How do you constrain an absolutely positioned element to a containing block?
make it a non-static property
48
What are the four box offset properties?
top right bottom left
49
What is the purpose of variables?
Storing information for a value
50
How do you declare a variable?
var name
51
How do you initialize (assign a value to) a variable?
assignment operator (=)
52
What characters are allowed in variable names?
alphanumerical values $ -
53
What does it mean to say that variable names are "case sensitive"?
Capitalization and typos matter a lot fullname != fullName
54
What is the purpose of a string?
Storing text
55
What is the purpose of a number?
Storing numbers
56
What is the purpose of a boolean?
Storing true/false values
57
What does the = operator mean in JavaScript?
Assignment operator
58
How do you update the value of a variable?
Assign a new value to the same variable
59
What is the difference between null and undefined?
Null is an empty value, undefined is no value has been assigned
60
Why is it a good habit to include "labels" when you log values to the browser console?
Makes it easier to reference & debug.
61
Give five examples of JavaScript primitives.
numbers string boolean undefined null
62
What data type is returned by an arithmetic operation?
a number
63
What is string concatenation?
when 2 strings get added together ex: fullName=firstName + lastName;
64
What purpose(s) does the + plus operator serve in JavaScript?
concatenation, addition
65
What data type is returned by comparing two values (, ===, etc)?
boolean
66
What does the += "plus-equals" operator do?
sets the variable to whatever the sum is equal to when it is added by a value
67
What are objects used for?
Containers for named values properties and methods.
68
What are object properties?
values associated with the object (keys)
69
Describe object literal notation.
The Object literal notation is basically 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, just like a regular array.
70
How do you remove a property from an object?
delete operator
71
What are the two ways to get or update the value of a property?
dot notation & bracket notation
72
What are arrays used for?
lists of values like a grocery list
73
Describe array literal notation.
square brackets
74
How are arrays different from "plain" objects?
plain objects can't contain more than one value
75
What number represents the first index of an array?
0
76
What is the length property of an array?
.length measures the length of the array
77
How do you calculate the last index of an array?
array.length - 1
78
What is a function in JavaScript?
a reusable command
79
Describe the parts of a function definition.
function keyword, the function name, the parameters, opening curly brace for the function code block, return statement, closing curly brace marking the end of code block
80
Describe the parts of a function call.
function name, the parentheses and parameters inside it, with a semicolon
81
When comparing them side-by-side, what are the differences between a function call and a function definition?
The function definition specifies the name, parameters and the code block instructions, whereas the function call just passes an argument to the function definition, and gets whatever is returned.
82
What is the difference between a parameter and an argument?
a parameter is a placeholder for the argument for a function. The argument is the actual data that is going to be used for the function.
83
Why are function parameters useful?
When a function is called, the parameters in its definition take on the values of the arguments that were passed.
84
What two effects does a return statement have on the behavior of a function?
return statement returns a value, and exits the function when it is called.
85
Why do we log things to the console?
debug and check code
86
What is a method?
a function of an object
87
How is a method different from any other function?
method exists as a property of an object
88
How do you remove the last element from an array?
pop method
89
How do you round a number down to the nearest integer?
round method
90
How do you generate a random number?
random method
91
How do you delete an element from an array?
splice [index, delete number]
92
How do you append an element to an array?
push method
93
How do you break a string up into an array?
split method
94
Do string methods change the original string? How would you check if you weren't sure?
No, use console.log
95
Roughly how many string methods are there according to the MDN Web docs?
mid 40s (dont have to memorize all)
96
Is the return value of a function or method useful in every situation?
No, because there are functions that modify things and there are those that return things
97
Roughly how many array methods are there according to the MDN Web docs?
more than 30, dont have to memorize all
98
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN
99
Give 6 examples of comparison operators.
< > <= >= == ===
100
What data type do comparison expressions evaluate to?
boolean
101
What is the purpose of an if statement?
checking the expression and make a decision with the result
102
Is else required in order to use an if statement?
not required
103
Describe the syntax (structure) of an if statement.
if (condition) code block return else return
104
What are the three logical operators?
and or not
105
How do you compare two different expressions in the same condition?
logical or and logical and
106
What is the purpose of a loop?
to repeat a set of instructions however many times specified.
107
What is the purpose of a condition expression in a loop?
to check if the loop should keep going
108
What does "iteration" mean in the context of loops?
how many times the code ran
109
When does the condition expression of a while loop get evaluated?
before executing the statement
110
When does the initialization expression of a for loop get evaluated?
before the loop begins
111
When does the condition expression of a for loop get evaluated?
after the initializer and right after incrementation
112
When does the final expression of a for loop get evaluated?
right after the loop finishes
113
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
break
114
What does the ++ increment operator do?
adds the value by 1 (i+=1)
115
How do you iterate through the keys of an object?
for in loop
116
Difference between i++ and ++i?
increments the value before they get substituted
117
What are the four components of "the Cascade".
importance, origin, specificity, position
118
What does the term "source order" mean with respect to CSS?
the further down it goes in the css code, the more "important it is"
119
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
inheritence
120
List the three selector types in order of increasing specificity.
type, class, id
121
Why is using !important considered bad practice?
makes it harder to debug
122
Why might you want to assign the return value of a DOM query to a variable?
to know the location of the variable in the document, so it's easier to access them
123
What console method allows you to inspect the properties of a DOM element object?
dir method
124
Why would a script tag need to be placed at the bottom of the HTML content instead of at the top?
you need to load your javascript dom after the document has been processed
125
What does document.querySelector() take as its argument and what does it return?
accepts css selectors, and returns the elements
126
What does document.querySelectorAll() take as its argument and what does it return?
it takes css selectors and returns NodeList
127
Why do we log things to the console?
test and debug your code
128
What is the purpose of events and event handling?
user input
129
What do [] square brackets mean in function and method syntax documentation?
it is optional
130
What method of element objects lets you set up a function to be called when a specific type of event occurs?
addEventListener method
131
What is a callback function?
function that is being used as an argument in another function, and which we do not call
132
What object is passed into an event listener callback when the event fires?
the event object
133
What is the event.target? If you weren't sure, how would you check? Where could you get more information about it?
its a reference to where the object is being invoked. the debugger. the mdn
134
What is the difference between these two snippets of code? element. addEventListener('click', handleClick) element. addEventListener('click', handleClick())
the event listener will call it when there are parantheses are inserted. When parantheses aren't there, it doesn't get called automatically.
135
Is the event parameter of an event listener callback always useful?
not always, but generally it is good practice
136
Would this assignment be simpler or more complicated if we didn't use a variable to keep track of the number of clicks?
it'd be harder
137
Why is storing information about a program in variables better than only storing it in the DOM?
cannot depend on the dom, so storing it on a variable makes it easier to find
138
What does the transform property do?
it modifies the coordinate space which lets you rotate, scale, skew or translate an element
139
Give four examples of CSS transform functions.
translate scale rotate skew matrix
140
What is the className property of element objects?
it lets you modify/replace the className on an existing html file on javascript
141
How do you update the CSS class attribute of an element using JavaScript?
you put the class location into a variable via getQuery and then use the className property
142
What is the textContent property of element objects?
it allows you to modify the text content inside an element
143
How do you update the text within an element using JavaScript?
put the element location inside a variable, then modify it using .textContent
144
Which "document" is being referred to in the phrase Document Object Model?
HTML document
145
What is the word "object" referring to in the phrase Document Object Model?
HTML elements
146
What is a DOM Tree?
an illustration of how the DOM reads the document with its elements and children
147
Give two examples of document methods that retrieve a single element from the DOM.
getQuery getElementByID
148
Give one example of a document method that retrieves multiple elements from the DOM at once.
getElementByClassName querySelectorAll
149
What event is fired when a user places their cursor in a form control?
focus
150
What event is fired when a user's cursor leaves a form control?
blur
151
What event is fired as a user changes the value of a form control?
input
152
What event is fired when a user clicks the "submit" button within a ?
submit
153
What does the event.preventDefault() method do?
prevents it from reloading the page and putting the information on the URL
154
What does submitting a form without event.preventDefault() do?
it refreshes the page and loads your information into the URL
155
What property of a form element object contains all of the form's controls.
getters
156
What property of form a control object gets and sets its value?
setters
157
What is one risk of writing a lot of code without checking to see if it works so far?
you won't know which part of the code is wrong
158
What is an advantage of having your console open when writing a JavaScript program?
allows you to debug and see if there are any errors
159
Does the document.createElement() method insert a new element into the page?
no
160
How do you add an element as a child to another element?
appendChild() method
161
What do you pass as the arguments to the element.setAttribute() method?
name+value
162
What steps do you need to take in order to insert a new element into the page?
create element then append child
163
What is the textContent property of an element object for?
retrieve/set text inside an element
164
Name two ways to set the class attribute of a DOM element.
classname, classlist, setattribute
165
What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?
reusability
166
Give two examples of media features that you can query in an @media rule.
style, link, source
167
Which HTML meta tag is used in mobile-responsive web pages?
meta name="viewport" tag
168
What is the event.target?
The target event property returns the element that triggered the event.
169
Why is it possible to listen for events on one element that actually happen its descendent elements?
event bubbling
170
What does the element.closest() method take as its argument and what does it return?
``` The closest() method traverses the Element and its parents (heading toward the document root) until it finds a node that matches the provided selector string. Will return itself or the matching ancestor. If no such element exists, it returns null . var closestElement = targetElement.closest(selectors); ```
171
What is the event.target?
The target event property returns the element that triggered the event.
172
What is the affect of setting an element to display: none?
makes the content invisible and removes it from the document
173
What does the element.matches() method take as an argument and what does it return?
string representing the selector to test. returns a boolean
174
How can you retrieve the value of an element's attribute?
``` getAttribute() let attribute = element.getAttribute(attributeName); ```
175
At what steps of the solution would it be helpful to log things to the console?
Every step
176
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?
multiple eventListeners
177
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?
Conditional statements to check each of the tabs
178
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?
because of cascading. If it happens after, it will override
179
How to you store data in localStorage?
storeItem method
180
How to you retrieve data from localStorage?
getItem method
181
What data type can localStorage save in the browser?
string (JSON.stringify)
182
When does the 'beforeunload' event fire on the window object?
before the document gets unloaded
183
What is a method?
sends objects to invoke behaviors and delegate the implementations to the receiving objects
184
How can you tell the difference between a method definition and a method call?
with the definition, you are writing the code, with the call, you are calling it and giving the values
185
Describe method definition syntax (structure).
object variable name, object properties, method
186
Describe method call syntax (structure).
dot method to call
187
How is a method different from any other function?
because it is a property inside an object
188
What is the defining characteristic of Object-Oriented Programming?
because an object can take properties and functions inside an object
189
What are the four "principles" of Object-Oriented Programming?
encapsulation, abstraction, inheritance, polymorphism
190
What is "abstraction"?
working with something complex and simplifying it
191
What does API stand for?
application programming interface
192
What is the purpose of an API?
an API delivers a user response to a system and sends the system's response back to a user.
193
What is this in JavaScript?
a keyword that contains a value that is defined at call time
194
What does it mean to say that this is an "implicit parameter"?
not explicitly written in a function, but it is always accessible
195
When is the value of this determined in a function; call time or definition time?
call time
196
``` What does this refer to in the following code snippet? var character = { firstName: 'Mario', greet: function () { var message = 'It\'s-a-me, ' + this.firstName + '!'; console.log(message); } }; ```
the object character
197
Given the above character object, what is the result of the following code snippet? Why? character.greet();
it would return "It's -a-me, Mario!"
198
``` Given the above character object, what is the result of the following code snippet? Why? var hello = character.greet; hello(); ```
it would be undefined, because hello is not connected to an object, whereas character.greet() has character as the object
199
How can you tell what the value of this will be for a particular function or method definition?
the value of this would be the object in which this was created.
200
How can you tell what the value of this is for a particular function or method call?
it would refer to whatever object calls the function
201
What kind of inheritance does the JavaScript programming language use?
prototypes
202
What is a prototype in JavaScript?
an object that has functionality inside it that other objects can use separately.
203
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?
using a function that prototypes for the objects
204
If an object does not have it's own property or method by a given key, where does JavaScript look for it?
prototype chain
205
What does the new operator do?
creates a new blank object and links the constructor to the other object to its parent prototype and sets the this, and returns this if the function doesn't return an object.
206
What property of JavaScript functions can store shared behavior for instances created with new?
prototype property
207
What does the instanceof operator do?
checks to see if the prototype chain exists in an object
208
What is a "callback" function?
A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.
209
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?
setTimeOut method
210
How can you set up a function to be called repeatedly without using a loop?
setInterval function
211
What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?
the default would be 0, it would get sent immediately
212
What do setTimeout() and setInterval() return?
it returns the timer ID
213
What is a client?
someone that requests a service from a server
214
What is a server?
answers requests from a client
215
Which HTTP method does a browser issue to a web server when you visit a URL?
get method
216
What three things are on the start-line of an HTTP request message?
verb like get put post and a noun like head or options
217
What three things are on the start-line of an HTTP response message?
protocol version status code and status text
218
What are HTTP headers?
information related to the request
219
Where would you go if you wanted to learn more about a specific HTTP Header?
mdn
220
Is a body required for a valid HTTP request or response message?
they are optional
221
What is AJAX?
Ajax allows you to update certain parts of a page without needing to reload the page. Ajax is a way to make asynchronous requests.
222
What does the AJAX acronym stand for?
asynchronous javascript and xml
223
Which object is built into the browser for making HTTP requests in JavaScript?
XML object
224
What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?
the load event
225
An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?
it is related to the event.target --
226
What is destructuring, conceptually?
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.
227
What is the syntax for Object destructuring?
let {} = variable
228
What is the syntax for Array destructuring?
let [] = variable
229
How can you tell the difference between destructuring and creating Object/Array literals?
if it's happening on the left side, it is destructuring, and the right side is defining
230
What is a code block? What are some examples of a code block?
some code inside curly braces
231
What does block scope mean?
A block scope is the area within if, switch conditions or for and while loops
232
What is the scope of a variable declared with const or let?
block scoped
233
What is the difference between let and const?
let can be changed, const stays the same
234
Why is it possible to .push() a new value into a const variable that points to an Array?
because the value is being changed, not the variable itself
235
How should you decide on which type of declaration to use?
seeing if the variable will be the same or it can change
236
What is the syntax for writing a template literal?
` ${variable} `
237
What is "string interpolation"?
the ability to substitute part of the string for the values of variables or expressions
238
What is the syntax for defining an arrow function?
(parameters) => {code block, return}
239
When an arrow function's body is left without curly braces, what changes in its functionality?
doesn't need a return statement
240
How is the value of this determined within an arrow function?
where the function is defined
241
What is a CLI?
command line interface
242
What is a GUI?
graphic user interface
243
``` Give at least one use case for each of the commands listed in this exercise. man cat ls pwd echo touch mkdir mv rm cp ```
man: description/options for the manual command cat: ls: pwd: echo: print out a status text touch: mkdir: mv: move a file or rename it rm: remove file/directories cp:
244
What are the three virtues of a great programmer?
laziness virtue hubris
245
What is Node.js?
As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications.
246
What can Node.js be used for?
anything
247
What is a REPL?
read eval print loop
248
When was Node.js created?
2009
249
What back end languages have you heard of?
PHP Node.JS
250
What is a computer process?
the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity.
251
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
100
252
Why should a full stack Web developer know that computer processes exist?
to see if the code that they made is running inside of the process
253
How do you access the process object in a Node.js program?
process (a global variable)
254
What is the data type of process.argv in Node.js?
array
255
What is a JavaScript module?
modules are a codeblock inside of a file that does a certain functionality. Modules are originally private, but if the dev passes it into the export object, it becomes public.
256
What values are passed into a Node.js module's local scope?
exports, require, module, __filename, __dirname
257
Give two examples of truly global variables in a Node.js program.
global, process, console, setTimeOut, setInterval
258
What is the purpose of module.exports in a Node.js module?
to call an object, variable, functions, etc from one file to another
259
How do you import functionality into a Node.js module from another Node.js module?
module.exports = function, then | require(./function.js)
260
What is the JavaScript Event Loop?
pushes async functions to the api, so that other functions can run at the same time. When the async function loads, it is pushed onto the queue stack, and when the stack is empty, the first function that is loaded onto the task queue is pushed onto the stack.
261
What is different between "blocking" and "non-blocking" with respect to how code is executed?
blocking is a piece of codeblocks that blocks other code from running.
262
What is a directory?
a location where a file is stored
263
What is a relative file path?
a local file stored inside a local computer
264
What is an absolute file path?
path from the route directory
265
What module does Node.js include for manipulating the file system?
fs
266
What method is available in the Node.js fs module for writing data to a file?
fs.writeFile()
267
Are file operations using the fs module synchronous or asynchronous?
asynchronous
268
What is on the first line of an HTTP request message?
request line, which represent the first line of a request message
269
What is on the first line of an HTTP response message?
status status code
270
What are HTTP headers?
HTTP headers let the client and the server pass additional information with an HTTP request or response
271
Is a body required for a valid HTTP message?
no
272
What is NPM?
node package manager. takes a module or package and sends it to a server so other developers can access and reuse it.
273
What is a package?
a package is a directory with one or more files in it.. It usually includes a package.json with metadata in it.
274
How can you create a package.json with npm?
npm init --yes
275
What is a dependency and how to you add one to a package?
Packages required by your application in production.
276
What happens when you add a dependency to a package with npm?
downloaded to the repo and then added to the json
277
How do you add express to your package dependencies?
``` npm install express const express = require('express') ```
278
What Express application method starts the server and binds it to a network PORT?
the listen method
279
How do you mount a middleware with an Express application?
the .use method
280
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
req and res
281
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json
282
What is the significance of an HTTP request's method?
to know what the user desires to do: GET (create), PUT , POST, DELETE, etc.
283
What is PostgreSQL and what are some alternative relational databases?
MySQL, Oracle, SQL Server
284
What are some advantages of learning a relational database?
when the application needs to quickly retrieve or store complex data in an organized fashion, a database fills that need nicely.
285
What is one way to see if PostgreSQL is running?
sudo service postgresql status or check the top in terminal
286
What is a database schema?
A collection of tables is called a schema. A schema defines how the data in a relational database should be organized.
287
What is a table?
A table is a list of rows each having the same set of attributes. For example, all students in a "students" table could have "firstName", "lastName", and "dateOfBirth" attributes.
288
What is a row?
a record of a specific item or person (for example: student id, name, height, gender, etc)
289
What is SQL and how is it different from languages like JavaScript?
SQL is a declarative programming language, which describes the result instead of telling it what to do
290
How do you retrieve specific columns from a database table?
select statment, and a string of the column name
291
How do you filter rows based on some specific criteria?
where clause.
292
What are four comparison operators that can be used in a where clause?
< > = !=
293
How do you limit the number of rows returned in a result set?
limit clause
294
How do you retrieve all columns from a database table?
select *
295
How do you control the sort order of a result set?
orderBy descending
296
What are the benefits of formatting your SQL?
readability and formatting
297
How do you add a row to a SQL table?
insert into "table" ("row name")
298
What is a tuple?
``` In SQL, a list of values is referred to as a tuple. aka values ('value1', 'value2') would be a tuple ```
299
How do you add multiple rows to a SQL table at once?
separate with comma and parentheses | values ('value1'), ('value2')
300
How do you get back the row being inserted into a table without a separate select statement?
returning * to output the row, or returning "column" to return a specific column
301
How do you update rows in a database table?
update "table" set "column" = 'value' where "id" = 'value'
302
Why is it important to include a where clause in your update statements?
if you do not put where, it updates the whole row
303
How do you delete rows from a database table?
delete from "table" | where "column" = 'value'
304
How do you accidentally delete all rows from a table?
if you don't put the where clause
305
What is a foreign key?
combining 2 columns that have a similar column
306
How do you join two SQL tables?
join clause using clause
307
How do you temporarily rename columns or tables in a SQL statement?
as clause
308
What are some examples of aggregate functions?
max(), sum(), min(), avg()
309
What is the purpose of a group by clause?
to take a certain column, and arrange the data to that certain column
310
What are the three states a Promise can be in?
pending, fulfilled, rejected
311
How do you handle the fulfillment of a Promise?
promise.then()
312
How do you handle the rejection of a Promise?
promise.catch()
313
What is Array.prototype.filter useful for?
it's useful as a "checker" for an array, to see which values match the conditions. If the condition is matched, it returns another array with the matching values.
314
What is Array.prototype.reduce useful for?
to combine all of the values of an array into a single datatype
315
What is "syntactic sugar"?
syntax used to make things easier to read or to express
316
What is the typeof an ES6 class?
function
317
Describe ES6 class syntax.
class name, constructor, methods
318
What is "refactoring"?
destructuring the code without changing the behavior
319
What is Webpack?
bundles js applications based on your imports and exports. takes all the files from the project and bundles it all in one big js file
320
How do you add a devDependency to a package?
npm install --save-dev webpack
321
What is an NPM script?
script that automates tasks.
322
How do you execute Webpack with npm run?
npm run build
323
How are ES Modules different from CommonJS modules?
more compact import export statements
324
What kind of modules can Webpack support?
ECMA, CommonJS, AMD
325
What is React?
JS library used to build user interfaces
326
What is a React element?
It's an object that virtually describes the DOM nodes that a component represents. With a function component, this element is the object that the function returns.
327
How do you mount a React element to the DOM?
using the render() method, the first argument is the element, and the 2nd argument is which container you want to put it in, 3rd is the callback
328
What is Babel?
Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments, also converts from jsx files to js
329
What is a Plug-in?
Software component that adds a specific feature to an existing computer program
330
What is a Webpack loader?
Loaders are transformations that are applied to the source code of a module. They allow you to pre-process files as you import or “load” them. Thus, loaders are kind of like “tasks” in other build tools and provide a powerful way to handle front-end build steps.
331
How can you make Babel and Webpack work together?
make webpack, babel and its plugins a dev dependency
332
What is JSX?
special syntax to allow html style writing inside javascript.
333
Why must the React object be imported when authoring JSX in a module?
In order to use the package from react, which allows us to use the jsx tags
334
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
As webpack bundles files together, babel works in the background to convert the file into an older, more accessible version of ecmascript
335
What is a React component?
Components let you split the UI into independent, reusable pieces, and think about each piece in isolation.
336
How do you define a function component in React?
function keyword, capitalized component name, and the return keyword with the elements.
337
How do you mount a component to the DOM?
render method with the jsx element, and the container
338
What are props in React?
properties, which are objects used to pass data from one component to another
339
How do you pass props to a component?
using curly braces and adding the properties in the middle
340
How do you write JavaScript expressions in JSX?
insert the expression between curly braces {}
341
What is the purpose of state in React?
in order to hold data, and to specify what to do with it with other methods
342
How to you pass an event handler to a React element?
use a onClick attribute and assign it to a method
343
What Array method is commonly used to create a list of React elements?
.map()
344
What is the best value to use as a "key" prop when rendering lists?
id, anything unique
345
What are controlled components?
input form where input is controlled by react
346
What two props must you pass to an input for it to be "controlled"?
handleChange and handleSubmit
347
What does express.static() return?
middleware
348
What is the local __dirname variable in a Node.js module?
returns the string of the directory name of where your file is located on the local pc
349
What does the join() method of Node's path module do?
it combines the path of the dirname with whatever you insert
350
What does fetch() return?
promise
351
What is the default request method used by fetch()?
get method
352
How do you specify the request method (GET, POST, etc.) when calling fetch?
fetch(url, { method: get/post }) put it on the 2nd argument
353
When does React call a component's componentDidMount method?
after the rennder phase
354
Name three React.Component lifecycle methods.
componentdidmount componentdidupdate componentwillunmount
355
How do you pass data to a child component? | Exercise
through props