ALL Flashcards

1
Q

7 data types

A

numbers, strings, boolean, objects, arrays, null, undefined

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

strings

A

words

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

what is interpolation

A

back ticks ``

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

interpolation operators

A

${}

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

how to combine text

A

“word” + “word”

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

Boolean

A

conditional statement if this do this

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

what is falsey data

A

false, null, undefined,null, 0, NaN, empty “ “

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

Strict Equality operators

A

===

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

strict inequality operators

A

!==

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

3 logical operators

A

Not (!), And (&&), Or(||)

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

tenary expressions

A

if then statement

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

tenary structure

A

value/condition ? return if true : return if false

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

Variable Declaration

A

a statement: const cat=”rose”

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

2 code statements

A

Selection and Repetition

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

Selection statement

A

if, else, else if

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

if statement structure

A

if (condition) {
thing to do if true
}

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

else statement structure

A

if (condition) {
thing to do if true
} else {
thing to do if false
}

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

if else

A

if (condition) {
thing to do if true
} else if (condition 2) {
thing to do if condition 2 is true}

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

switch statement

A

alternate for conditional statement with multiple conditions again same value

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

switch statement structure

A

switch (expression) {
case value1:
//Statements executed when the
//result of expression matches value1
[break;]
case value2:
//Statements executed when the
//result of expression matches value2
[break;]

case valueN:
//Statements executed when the
//result of expression matches valueN
[break;]
[default:
//Statements executed when none of
//the values match the value of the expression
[break;]]
}

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

Default

A

set of statements to run after all of the switch statement cases have been checked

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

Break

A

stop switch statement from continuing to look at case statements once it finds a match

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

logging

A

process of printing information about the program as it runs. example: console.log

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

Repetition statement

A

while

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

while loop structure

A

while (condition) {
do if condition is true
}

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

increment/decrement operators

A

add ++ or +=
subtract – or -=

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

terminate while loop naturally

A

let count = 0
while (count <3){
return ${count};
count = count++
}

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

function structure

A

function functionName (parameter) {
code to run when function is called
}

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

parameter

A

placeholder for argument that will get passed through

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

return

A

statement ends function execution and specifies a value to be returned to the function caller

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

parseInt()

A

turns number inside “ “ from strings into numbers

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

2 Data Structures

A

Array and Objects

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

Arrays

A

collections of values in ordered lists

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

Elements

A

individual pieces of data inside an array

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

index

A

number that identify each element in array

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

object

A

list of values using key and value

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

array structure

A

const arrayName = [
data, data
]

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

.length

A

finds the number of elements in an array

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

what is the index of the first element in an array

A

0

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

how to update an array

A

arrayName[index] = “no element”

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

destructive mutability

A

methods update or mutate the object

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

nondestructive mutability

A

doesn’t change the value

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

Array methods

A

ways to add, remove and change elements

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

add elements destructively to array

A

.push() and .unshift()

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

add elements to array non destructively

A

spread operator …

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

.push ()

A

add to end of array

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

.unshift ()

A

add to beginning of array

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

spread operator

A

… creates a copy of the original array to be changed l

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

structure to use spread to add to beginning of array

A

const newArray = [“new element”, … oldArray]

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

structure to spread to add to end of array

A

const newArray = [ … oldArray, “new element”]

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

remove elements from aray

A

.pop(), ,shift(), .slide()

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

.pop()

A

removes last element destructively

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

.shift()

A

removes first element destructively

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

.slice ()

A

makes copy of removed indexes in parameter

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

.slice () strucutre

A

array.slice(index to start number after this index will be removed, index to end slice)

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

.splice structure

A

array.splice(start index, delete count, element to add)

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

object structure

A

const objectName = {
key 1: value 1,
key 2 : value 2,
};

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

access value in object

A

dot notation, bracket notation

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

dot notation

A

objectName. key

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

bracket notation

A

objectName[“key”]

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

object.keys ()

A

pulls all of the keys at the top level of object

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

What does object.values return?

A

returns the object values

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

adding property to object with dot notation

A

object.key = new value

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

adding property to object with bracket notation

A

object [“key”] = new value

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

structure to use spread to add to object

A

function nondestructive (object, key,value) {
const newObject = {…oldObject};
newObject[“key”] = value;
return newObject;
}

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

remove a property

A

delete object.key

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

debugging in Node

A

add debugger keyword where you want a breakpoint

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

for loop structure

A

for (initialization; condition; iteration) {
loop body
}

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

initialization

A

counter values. let age=30

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

condition

A

expression evaluated before each pass through. age<40

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

iteration

A

what happens at the end of each loop through. age++

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

loop body

A

code that runs on each pass through

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

while loop

A

while (condition) {
loop body
}

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

looping

A

process of executing a set of statements repeatedly until a condition is met

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

iteration

A

process of executing a set of statements once for each element

76
Q

for … of structure

A

const myArray =[ ];
for (const element of myArray) {
console.log(element);
}

77
Q

for… of for array or object?

A

array

78
Q

for… in for array or object

A

object

79
Q

for… in strucutre

A

for( const key in object) {
console.log(key);
}

80
Q

function expression

A

const name = function () {
return “ “;
}

81
Q

anonymous functions

A

no assigned identifier (no function name)

82
Q

Scope

A

what you can access it and where you can access it

83
Q

levels of scope

A

Global- highest level
Functional - in function
block - if then in function

84
Q

hoisting

A

call function before a function

85
Q

what are first class functions

A

functions as variables

86
Q

while in a function

A

function functionName (parameter) {
let i=0(intiatlization);
while(condition){
console.log();
i++ (iteration);
}

87
Q

iterating methods

A

find()
filter()
map()
reduce()

88
Q

.find()

A

find single element that meets condition

89
Q

.filter()

A

find and returning a list that meets a condition

90
Q

.map()

A

modifying each element and return modify array

91
Q

.reduce()

A

creating summary (adds all of the elements together)

92
Q

pure function

A

function when invoked with the same arguments will always return the same results

93
Q

impure function

A

functions when invoked with the same arguments will return different results

94
Q

arrow function structure

A

const name = (parameter, parameter) => function body

95
Q

arrow function with 1 parameter

A

const name = parameter=> function body

96
Q

callback function

A

function called into another function

97
Q

callback function stucture

A

function main(cb) {
console.log (cb());
}
main(function(){return “Hi”})

98
Q

.forEach

A

executes function once for each array element.

99
Q

When to use .forEach

A

-iterate through to log values
-directly mutate array we iterate though

100
Q

structure to destruction of objects

A

let object = {
key1 = value 1,
key2 = value 2,
}
const{first, second} = object
console.log(first) //value1

101
Q

structure to destruction of array

A

const array =[data1, data2,data3]
const [first, second, third] = array
console.log(first,second, third) // data1, data2, data3

102
Q

structure destruction of strings

A

const name= “Rachel J Hamby”
const [firstName, middle, lastName] = name.split(“ “)
console.log(firstName) // Rachel

103
Q

.querySelectorALL()

A

takes a string containing 1 or more class selectors and returns a collection of all matching elements

104
Q

.querySelector()

A

take a string of 1 or more CSS compatible selectors and returns the first element that matches

105
Q

what is used to describe DOM structure

A

a tree

106
Q

Metadata

A

the class/id attributes that provide information about the node (the words in <></> )

107
Q

.getElementByClassName(‘class’)

A

returns an array of all the elements with that class

108
Q

.getElementByTagName(‘tag’)

A

returns all the elements with a particular tag

109
Q

.getElementByID(‘id’)

A

returns the element with specific id

110
Q

where should you put


A

at the end of body or use keyword defer before

111
Q

child node

A

node nested inside another node

112
Q

parent node

A

outer node with node nested inside it

113
Q

self closing elements

A

aka void elements
only have a starting tag but no closing tag < information />

114
Q

can you nest nodes in self closing elements

A

no

115
Q

what does HTML consist of

A

elements that include HTML tags and their content

116
Q

What does DOM const of

A

nodes that include tags

117
Q

what are nodes

A

objects in Dom

118
Q

all elements in DOM are nodes but not all nodes are HTML elements

A

true

119
Q

open index.html

A

when typed in terminal will open browser console to show results of code

120
Q

how open browser console on Mac

A

countrol + opt + J

121
Q

API

A

Application Programming Interface- methods and properties the DOM provides via objects

122
Q

DOM stand for

A

Document Object Model programming

123
Q

what does DOM use JS to do

A
  1. Ask DOM to find an HTML element(s) in the rendered page
  2. Remove or add to the selected element
  3. adjust a property of selected element
124
Q

Flatiron’s 3 pillars of web programming

A
  1. recognize events
  2. manipulate the DOM
  3. Communicate with the server
125
Q

structure to assign default parameter

A

function functionName(parameter1, parameter2= default value){
return “parameter1, parameter2}

126
Q

Change Text of Dom

A

element.textContent or element.innerText

127
Q

what does .textContent and .innerText select

A

text inside an element

128
Q

what are some attributes you can change in the DOM

A

.sre
.id
.className
.style

129
Q

structure for changing attributes in the DOM

A

element.attributeToChange

130
Q

create a DOM element with Javascript

A

document.createElement(“tag name”)

131
Q

what are tag names

A

any HTML tag such as p, div, btn

132
Q

how to add new element to the existing DOM

A

.append()

133
Q

structure for appending element to DOM

A

document. element to append to. append(“new element”)

134
Q

what are HTML,JS, and CSS role in application development

A

HTML- defines structure of website
JS- defines functionality of website
CSS - defines visualization and style of website

135
Q

how to remove elements from DOM

A

element.remove() this removes the whole element or element.removeChild(childElement) this removes on the child element listed

136
Q

what is event handleing

A

doing work in response to something happening on the webpage

137
Q

what are events

A

something the user does (click, scroll, etc)

138
Q

Common Events

A

mouse click
key Press
form submit
scroll
focus
blur

139
Q

.addEventListener

A

add to element we want to listen and pass it 2 arguments 1. name event to listen for 2. call back function to handle the event

140
Q

.addEvent Listener structure

A

element to assign event. addEventListener(event, call back function)

141
Q

can assign callback directly in .addEventListener or assign outside and call just the name of the callback

A

true

142
Q

HTML collections are arrays

A

false

143
Q

.target

A

returns the element that triggered the event

144
Q

what is the event name for a form

A

submit

145
Q

how do you stop default of an event

A

.preventDefault

146
Q

DOMContentLoaded

A

is an event that says to wait to perform until all of DOM has loaded

147
Q

structure DomContentLoaded

A

document.addEventListener(“DomContentLoaded”, () => {
what to run after the DOM is fully loaded. Put all of the JS in this section.
}

148
Q

Load different then DomContentLoaded

A

Load waits until all of images and CSS load before running the JS

149
Q

what is AJAX

A

process used to make requests to the server and update the DOM without reloarding the webpage

150
Q

what format does sever return data

A

JSON

151
Q

what is JSON

A

Javascript Object Notation.

is a string that JS knows how to make into an object

152
Q

what is the request response cycle

A

client (browser) request to Server (code running the website). Server send response back to client

153
Q

HTTP

A

language used to communicate between the server and client

154
Q

HTTP verbs

A

POST, GET, PATCH/PUT, DELETE,
other ones: HEAD, TRACE, OPTIONS, CONNECTS

155
Q

CRUD HTTP

A

Create
Read
Update
Delete

156
Q

What is REST

A

REpresentational State Transfer

standardised web communication

157
Q

what is URL

A

Uniform Resource Locators

158
Q

3 parts of URL

A
  1. protocol (http://)
  2. Domain Name (name.com)
  3. the path (/where/togo)
159
Q

url protocol

A

format we use to send our request

160
Q

url domain name

A

string of characters that indentifies the unique web location of the web server that host that particular website

161
Q

path url

A

the particular part of the website we want to load

162
Q

GET

A

most common

retrieves information of a source

163
Q

POST

A

create new resource using data in the request

164
Q

PUT

A

update an exisiting resource using data in the request

165
Q

DELETE

A

delete a particular resource

166
Q

HEAD

A

asks for a response (like GET without the body)

167
Q

TRACE

A

echos back the received request

168
Q

OPTIONS

A

returns the HTTP methods the server supports

169
Q

CONECTS

A

convert the request to a TCP/IP tunnel (generally for SSL)

170
Q

Request Headers

A

contains the information needs to fulfill the request

171
Q

Request Headers format

A

method: HTTP verb
path: the resource
authority: the domain

172
Q

Responses

A

2 sections: Headers and Body

173
Q

response headers

A

contain metadata about response including status load

174
Q

response body

A

what is rendered on the page

175
Q

status codes

A

tells status of the request

176
Q

what are 3 advantages of JSON

A
  1. human readable
  2. easy to convert to JS object
  3. compatible with other programming languages
177
Q

Asynchronous JS

A

delayed functions that don’t follow the general order of line by line in JS

178
Q

setTimeOut structure

A

setTimeOut{() => console.log(‘hi’), 3000}

179
Q

How to start the sever

A

json-server –watch db.json

180
Q

fetch()

A

asynchronous funtion that retrieves data simply by calling fetch() and passing the resource path as the argument

181
Q

API

A

application programming interface is a way to expose others to data and/or functionality for public use

182
Q

Synchronous

A

do one thing after finishing the first in order from left to right top to bottom

183
Q

asynchronous

A

do a little of each task until all the task are complete

184
Q

how to spot asynchronous

A

the task being passed a callback function

185
Q

fetch() structure

A

function name(object) {
fetch(http://localhost:3000/data/) {
method: “HTTP VERB”,
headers:{
‘content- type’ : ‘application/json’}
body: JSON.stringify(object)})
.then(res => res.json())
.then (example => console.log(object))
}