JavaScript Flashcards

1
Q

Why do we log things to the console?

A

to see the state of the code
tracking values, debugging

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

What is a “model”?

A

a recreation of something for resemblance

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

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

A

HTML document

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

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

A

javascript object

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

What is a DOM Tree?

A

element and all of its content

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

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

A

queryselector and getelementbyid

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

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

A

to be able to reuse it later
so you don’t have to do the same work

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

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

A

so the html and css finishes loading

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

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

A

css selector and it returns first element of that selector

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

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

A

css selector and a nodelist with all elements with that selector

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

Why do we log things to the console?

A

to verify values and debug

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

What is the purpose of events and event handling?

A

events are for detecting user interaction and response

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

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

A

no

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

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

A

addeventlistener

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

What is a callback function?

A

function that gets called when something else happens

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

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

A

callback function

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

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

A

event target is to see which event triggered. if you didn’t know, you could look it up on mdn

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

What is the className property of element objects?

A

get or set value of class attribute on html element

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

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

A

classname property of object equal operator to value

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

What is the textContent property of element objects?

A

text that is being displayed

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

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

A

no

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

more complicated

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

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

A

focus event

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

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

A

blur event

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

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

A

value event

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

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

A

submit event

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

What does the event.preventDefault() method do?

A

prevent someone from doing the default behavior of event

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

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

A

refreshes the page

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

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

A

elements

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

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

A

value

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

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

A

it could break along the way

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

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

A

no

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

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

A

appendchild method

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

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

A

first argument would be the attribute you want, the second would be the value

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

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

A

appendchild to an element inside the page already

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

What is the textContent property of an element object for?

A

get value or reassign text

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

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

A

property classname, and assign it a value, or use setattribute method

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

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

A

function is reusable and the return can be used somewhere else

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

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

A

min-width and min-height

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

What is the event.target?

A

the origin of the element that got triggered

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

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

A

event bubbling

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

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

A

tagName

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

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

A

css selector and returns closest parent element

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

How can you remove an element from the DOM?

A

remove method

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

What is the event.target?

A

the origin element that got triggered

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

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

A

takes it out of view and document flow

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

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

A

takes css selector as argument and return boolean depending on if the targeted element matches the css selector

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

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

A

getattribute method

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

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

A

anytime u need it

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

need an event listener for each tab

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

What is a breakpoint in responsive Web design?

A

the point where the layout/ website changes to adjust for devices

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

adaptability and less possible failure points

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

What is JSON?

A

way to store long term data by converting data into strings

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

What are serialization and deserialization?

A

serialization is to convert human data for humans into data for the computer. deserialization is to convert computer data into readable human data.

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

Why are serialization and deserialization useful?

A

to store and transfer data in an efficient way.

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

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

A

stringify method of JSON object or type it out

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

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

A

parse method of JSON object

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

How do you store data in localStorage?

A

setItem method

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

How do you retrieve data from localStorage?

A

getItem method, keyname as argument

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

What data type can localStorage save in the browser?

A

a string

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

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

A

when the tab is refreshed or closed

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

What is a method?

A

function being stored in property of an object

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

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

A

if a method is being defined the word function will be prevalent. if it is being called only the function name followed by parentheses will be present.

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

Describe method definition syntax (structure).

A

object name, dot, method name, followed by parentheses and argument.

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

Describe method call syntax (structure).

A

object name, dot, function name, paranthesis

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

How is a method different from any other function?

A

you have to specify object name before with a dot

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

What is the defining characteristic of Object-Oriented Programming?

A

pairing data with behavior in the same space

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

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

A

abstraction, encapsulation, inheritance, polymorphism

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

What is “abstraction”?

A

take a complex tool and give a simple interface for it

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

What does API stand for?

A

Application programming interface

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

What is the purpose of an API?

A

allow people to use complex tools without fully understanding/creating them

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

What is this in JavaScript?

A

gets the value of whatever is being used

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

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

A

implied that it’s there, no visual queues to be seen

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

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

A

call time

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

What does this refer to in the following code snippet?

A

nothing

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

What kind of inheritance does the JavaScript programming language use?

A

prototype based programming

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

What is a prototype in JavaScript?

A

an object with methods you can use on the main variable

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

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

A

prototype

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

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

What does the new operator do?

A

creates a new data set based on the function called

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

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

A

prototype

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

What does the instanceof operator do?

A

It checks to see if it has the prototype/methods of an object

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

What is a “callback” function?

A

function that gets executed later

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

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

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

A

setInterval

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

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

A

0

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

What do setTimeout() and setInterval() return?

A

the interval ID

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

What is AJAX?

A

sending information, receiving information and updating without refreshing the site.

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

What does the AJAX acronym stand for?

A

Asynchronous JavaScript And XML

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

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

A

XML http request

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

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

A

load event

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

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

A

XHR shares prototype with dom elements.

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

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

A

curly braces

96
Q

What does block scope mean?

A

area of where the variable exists inside a block

97
Q

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

A

block

98
Q

What is the scope of a variable declared with var

A

block, var variables are function scoped

99
Q

What is the difference between let and const?

A

let can be reassigned

100
Q

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

A

value of content is mutable, but not reassignable

101
Q

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

A

use const until you cant

102
Q

What is the syntax for writing a template literal?

A

string ${variable}

103
Q

What is “string interpolation”?

A

substitute string with variables

104
Q

What is destructuring, conceptually?

A

getting property values/array elements and assigning them into multiple variables in one line

105
Q

syntax for object destructuring

A

let {property: variableName} = object

106
Q

syntax for array destructuring

A

let [a, b, c] = array

107
Q

How can you tell the difference between destructuring and creating object/array literals

A

where the brackets are located, left is destructuring, while creating is on the right of the assignment operator

108
Q

What is the syntax for defining an arrow function?

A

parameter, equals greater than, then code block

109
Q

What is the syntax for defining an arrow function?

A

parameter, equals greater than, then code block or return expression

110
Q

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

A

implicit return for statement (return expression)

111
Q

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

A

it shadows the outer function

112
Q

What is a CLI?

A

command line interface

113
Q

What is a GUI?

A

graphical user interface

114
Q

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

A

man - manual
cat - see content
ls - list items in a directory
pwd - print directory
echo - create text
touch - create file/ change time
mkdir - make folder/directory
mv - rename/move directory
rm - remove files/directories
cp - copy

115
Q

What are the three virtues of a great programmer?

A

laziness, impatient, humorous

116
Q

What is Node.js?

A

way to run javascript outside a web browser

117
Q

What can Node.js be used for?

A

backend for web apps, command line programs

118
Q

What is a REPL?

A

read–eval–print loop
takes input, executes actions, returns product to the user

119
Q

When was NodeJS created?

A

May 27, 2009

120
Q

What back end languages have you heard of?

A

ruby, python, java, rust, javascript, php, c++, golang, c, c#

121
Q

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

A

global variable that stores data about entire program

122
Q

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

A

you can just reference it like any other variable

123
Q

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

A

array of strings

124
Q

What is a JavaScript module?

A

a new js file, containing code of a smaller component out of a bigger codebase

125
Q

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

A

filename, dirname, module, exports, require

126
Q

Give two examples of truly global variables in a Node.js program.

A

process and console

127
Q

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

A

to be able to use a value from that module

128
Q

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

A

require function

129
Q

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

A

global variable with all of the information about current process

130
Q

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

A

reference process, because it is global

131
Q

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

A

array

132
Q

What is a JavaScript module?

A

another js file containing a small part of code

133
Q

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

A

export, module, require, __filename, __dirname

134
Q

Give two examples of truly global variables in a Node.js program.

A

global & process

135
Q

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

A

get a value from a module to be able to use into others

136
Q

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

A

require function

137
Q

What is the JavaScript Event Loop?

A

responsible for taking callbacks from stack and putting them in a queue

138
Q

What is a directory?

A

folder

139
Q

what is a relative file path

A

specifies path from current spot

140
Q

what is an absolute file path

A

specifies path from root directory

141
Q

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

A

writeFile

142
Q

What is a client?

A

computer that sends a request to a server

143
Q

What is a server?

A

computer that respond to requesters with information

144
Q

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

A

GET request

145
Q

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

A

HTTP method, request target, protocol version

146
Q

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

A

protocol, status code, and text for status

147
Q

What are HTTP headers?

A

extra meta information

148
Q

Is a body required for a valid HTTP message?

A

no

149
Q

What is NPM?

A

node package manager

150
Q

What is a package?

A

pre made reusable code (package.json, directory, one or more files)

151
Q

How can you create a package.json with npm?

A

npm init –yes

152
Q

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

A

third party code that you can use

153
Q

How do you add express to your package dependencies?

A

npm install express

154
Q

How do you add express to your package dependencies?

A

npm install express

155
Q

How do you mount a middleware with an Express application?

A

use method to the app object, and callback function will be an argument. cb will be middleware

156
Q

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

A

applications/json

156
Q

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

A

allows the programmer to know what function to do

157
Q

What is a database schema?

A

how database is stored

158
Q

What is a table?

A

collection of rows where every row has attribute

159
Q

What is a row?

A

each specific item

160
Q

What is PostgreSQL and what are some alternative relational databases?

A

postgresql is a relational database, an alternative to relational database is monodb which uses json

161
Q

What are some advantages of learning a relational database?

A

efficiency and organizing

162
Q

What does the express.json() middleware do and when would you need it?

A

parses JSON body of request, and you would need it anytime you want to change data

163
Q

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

A

in SQL we state what we want and we get it, while in JS we declare things and get create the result by ourselves

164
Q

How do you retrieve specific columns from a database table?

A

select keyword then column names separated by commas

165
Q

How do you filter rows based on some specific criteria?

A

where clause

166
Q

What are the benefits of formatting your SQL?

A

organizing

167
Q

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

A

limit keyword

168
Q

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

A

=, !=, <, >

169
Q

How do you retrieve all columns from a database table?

A

*

170
Q

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

A

order by keyword

171
Q

What is a tuple?

A

a row

172
Q

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

A

returning

173
Q

How do you add a row to a SQL table?

A

insert value, them tuple

174
Q

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

A

multiple tupiles

175
Q

How do you specific update rows in a database table?

A

set what you want with a where clause

176
Q

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

A

you will update everything that meets that condition

177
Q

How do you delete rows from a database table?

A

delete from “table”

178
Q

what is a foreign key?

A

shared data value

179
Q

How do you join two SQL tables?

A

join keyword followed by table name in quotes, followed by using keyword and foreign key in quotes in paranthesis

180
Q

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

A

as keyword - you can use it on columns and tables

181
Q

What are some examples of aggregate functions?

A

sum, count, max

182
Q

What is the purpose of a group by clause?

A

separate rows into groups

183
Q

what are the 3 states a promise can be in

A

pending, fulfilled, and rejected

184
Q

How do you handle the fulfillment of a Promise?

A

.then method

185
Q

How do you handle the rejection of a Promise?

A
186
Q

What is Array.prototype.filter useful for?

A

get specific elements for an array

187
Q

what is webpack

A

create a bundle out of modules

188
Q

How do you add a devDependency to a package?

A

–save-dev

189
Q

what is an npm script

A

automate npm commands

190
Q

how do u execute webpack with npm run

A

npm run (key)

191
Q

What is “syntactic sugar”?

A

write code in a readable way

192
Q

What is the typeof an ES6 class?

A

function

193
Q

Describe ES6 class syntax.

A

function name, brackets, then constructor, parameter, brackets, then methods name, parameter, brackets

194
Q

What is “refactoring”?

A

rewriting code to improve it without affecting functionality

195
Q

How are ES Modules different from CommonJS modules?

A

syntax, es6 modules are async, es6 modules are official

196
Q

what is react

A

frontend framework

197
Q

What is a React element?

A

object

198
Q

How do you mount a React element to the DOM?

A

grab a real root element, make it a react root, set a react element, and mount the element to the root by using render method

199
Q

what is babel

A

compiler to convert different versions of js to more compatible versions

200
Q

what is a plugin

A

additional software on pre existing software

201
Q

what is a webpack loader

A

transformations that are applied to the source code of a module

202
Q

how can you make babel and webpack work together

A

use babel loader in webpack

203
Q

what is jsx?

A

javascript syntax extension

204
Q

why must the react object be imported when authoring jsx in a module

A

jsx compiles into react

205
Q

how can you make webpack and babel work together to convert jsx into valid JavaScript

A

we use babel loader plugins to convert into valid JS and webpack takes all of modules & packages & bundles them

206
Q

What is a React component?

A

function that returns react elements

207
Q

How do you define a function component in React?

A

regular function definition with capital first letter as name, and parameter props

208
Q

How do you mount a component to the DOM?

A

call render method of root object passing component as argument

209
Q

library vs framework

A

ioc (inversion of control)
library - code that you call
framework - calls your code, you give ur power to framework

210
Q

what are props in react

A

object that contains properties

211
Q

How do you pass props to a component?

A

prop name equals value, if it is an expression it has to be wrapped in curly braces

212
Q

How do you create “class” component in React?

A

define class but extends to React.Component and need atleast one prototype method that is render, and that render returns react element

213
Q

what is the purpose of state in react

A

data model of values that changes overtime

214
Q

What are controlled components?

A

inputs values is owned by state of component

215
Q

What two props must you pass to an input for it to be “controlled”?

A

value and onChange

216
Q

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

A

.map

217
Q

What does express.static() return?

A

a function

218
Q

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

A

path to the current directory

219
Q

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

A

combines strings to form a path

220
Q

what does fetch() return

A

promise

221
Q

what is the default request method used by fetch()

A

get

222
Q

When does React call a component’s componentDidMount method?

A

after the first render

223
Q

Name three React.Component lifecycle methods.

A

constructor, render, componentdidmount

224
Q

How do you pass data to a child component?

A

props

225
Q

what does a LIFO mean?

A

last in first out

226
Q

What methods are available on a Stack data structure?

A

pop and push

227
Q

What must you do to access the value at an arbitrary point in a stack (not just the “top”)?

A

you have to pop until you reach that point

228
Q

What must you do to access the value at an arbitrary point in a stack (not just the “top”)?

A

you have to pop until you reach that point

229
Q

What does the acronym FIFO mean?

A

first in first out

230
Q

What methods are available on a Queue data structure?

A

enqueue and dequeue

231
Q

What must you do to access the value at an arbitrary point in a queue (not just the “front”)?

A

get rid of the ones before

232
Q

how are linked lists different from an array

A

in an array u can go to a random index while in a linked list its linear

233
Q

how would u access an arbitrary node in a linked list (not just the “head”)?

A

to get to an arbitrary node in a linkedlist u have to go through everything before it

234
Q

In JavaScript, when is a function’s scope determined; when it is called or when it is defined?

A

defined