ALL Flashcards

(185 cards)

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
while loop structure
while (condition) { do if condition is true }
26
increment/decrement operators
add ++ or += subtract -- or -=
27
terminate while loop naturally
let count = 0 while (count <3){ return ${count}; count = count++ }
28
function structure
function functionName (parameter) { code to run when function is called }
29
parameter
placeholder for argument that will get passed through
30
return
statement ends function execution and specifies a value to be returned to the function caller
31
parseInt()
turns number inside " " from strings into numbers
32
2 Data Structures
Array and Objects
33
Arrays
collections of values in ordered lists
34
Elements
individual pieces of data inside an array
35
index
number that identify each element in array
36
object
list of values using key and value
37
array structure
const arrayName = [ data, data ]
38
.length
finds the number of elements in an array
39
what is the index of the first element in an array
0
40
how to update an array
arrayName[index] = "no element"
41
destructive mutability
methods update or mutate the object
42
nondestructive mutability
doesn't change the value
43
Array methods
ways to add, remove and change elements
44
add elements destructively to array
.push() and .unshift()
45
add elements to array non destructively
spread operator ...
46
.push ()
add to end of array
47
.unshift ()
add to beginning of array
48
spread operator
... creates a copy of the original array to be changed l
49
structure to use spread to add to beginning of array
const newArray = ["new element", ... oldArray]
50
structure to spread to add to end of array
const newArray = [ ... oldArray, "new element"]
51
remove elements from aray
.pop(), ,shift(), .slide()
52
.pop()
removes last element destructively
53
.shift()
removes first element destructively
54
.slice ()
makes copy of removed indexes in parameter
55
.slice () strucutre
array.slice(index to start number after this index will be removed, index to end slice)
56
.splice structure
array.splice(start index, delete count, element to add)
57
object structure
const objectName = { key 1: value 1, key 2 : value 2, };
58
access value in object
dot notation, bracket notation
59
dot notation
objectName. key
60
bracket notation
objectName["key"]
61
object.keys ()
pulls all of the keys at the top level of object
62
What does object.values return?
returns the object values
63
adding property to object with dot notation
object.key = new value
64
adding property to object with bracket notation
object ["key"] = new value
65
structure to use spread to add to object
function nondestructive (object, key,value) { const newObject = {...oldObject}; newObject["key"] = value; return newObject; }
66
remove a property
delete object.key
67
debugging in Node
add debugger keyword where you want a breakpoint
68
for loop structure
for (initialization; condition; iteration) { loop body }
69
initialization
counter values. let age=30
70
condition
expression evaluated before each pass through. age<40
71
iteration
what happens at the end of each loop through. age++
72
loop body
code that runs on each pass through
73
while loop
while (condition) { loop body }
74
looping
process of executing a set of statements repeatedly until a condition is met
75
iteration
process of executing a set of statements once for each element
76
for ... of structure
const myArray =[ ]; for (const element of myArray) { console.log(element); }
77
for... of for array or object?
array
78
for... in for array or object
object
79
for... in strucutre
for( const key in object) { console.log(key); }
80
function expression
const name = function () { return " "; }
81
anonymous functions
no assigned identifier (no function name)
82
Scope
what you can access it and where you can access it
83
levels of scope
Global- highest level Functional - in function block - if then in function
84
hoisting
call function before a function
85
what are first class functions
functions as variables
86
while in a function
function functionName (parameter) { let i=0(intiatlization); while(condition){ console.log(); i++ (iteration); }
87
iterating methods
find() filter() map() reduce()
88
.find()
find single element that meets condition
89
.filter()
find and returning a list that meets a condition
90
.map()
modifying each element and return modify array
91
.reduce()
creating summary (adds all of the elements together)
92
pure function
function when invoked with the same arguments will always return the same results
93
impure function
functions when invoked with the same arguments will return different results
94
arrow function structure
const name = (parameter, parameter) => function body
95
arrow function with 1 parameter
const name = parameter=> function body
96
callback function
function called into another function
97
callback function stucture
function main(cb) { console.log (cb()); } main(function(){return "Hi"})
98
.forEach
executes function once for each array element.
99
When to use .forEach
-iterate through to log values -directly mutate array we iterate though
100
structure to destruction of objects
let object = { key1 = value 1, key2 = value 2, } const{first, second} = object console.log(first) //value1
101
structure to destruction of array
const array =[data1, data2,data3] const [first, second, third] = array console.log(first,second, third) // data1, data2, data3
102
structure destruction of strings
const name= "Rachel J Hamby" const [firstName, middle, lastName] = name.split(" ") console.log(firstName) // Rachel
103
.querySelectorALL()
takes a string containing 1 or more class selectors and returns a collection of all matching elements
104
.querySelector()
take a string of 1 or more CSS compatible selectors and returns the first element that matches
105
what is used to describe DOM structure
a tree
106
Metadata
the class/id attributes that provide information about the node (the words in <> )
107
.getElementByClassName('class')
returns an array of all the elements with that class
108
.getElementByTagName('tag')
returns all the elements with a particular tag
109
.getElementByID('id')
returns the element with specific id
110
where should you put