javascript Flashcards

1
Q

Does a variable have to be declared and assigned at the same time?

A

No, you can give it a name and then later in the code assign it a variable

var a;

(then later)

a = 7

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

what do we put at the end of our code to signify that it is the end?

A

;

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

What is the assignment operator?

A

=

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

what does the assignment operator do?

A

it assigns a value to a variable name

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

what does console.log( ) do?

A

allows you to see things in the console.

console.log(a);

this will return the value of (a) in the console

a = 7

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

can you use console.log ( ) to see what variables were at specific points in your program? how?

A

yes, you can. You can place console.log ( ) both before and after the change of value and it will print out the different values for each assignment

a = 7
console.log(a)

a = ‘happy’

console.log(a)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
7
‘happy’

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

what does a not defined string or name cause?

A

an error

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

what is the value set to a variable name that has not been assigned a value?

A

undefined

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

how can you increment number values by one?

A

variableName++;

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

how can you lower number values by one?

A

variableName–;

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

what are decimal numbers called?

A

floats

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

what is the operator to find the remainder of two numbers?

A

%

10 % 2;
= 0 (no remainder)

11 % 3;
= 2 (remainder)

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

what do we often use the remainder operator for?

A

to figure out if a a number is even or odd. If we can divide a number by 2 and it returns a remainder of 0, then it is even.

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

What shorthand can you use to add a variable name to a number? For instance, a = a + 7.

A

+=

a += 7

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

What shorthand can you use to subtract a variable name to a number? For instance, a = a - 7.

A

-=

a-=7

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

What is it called when you use the shorthand to apply an arithmetic operator to a variable name? (ex: a += 12)

A

Compound assignment

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

What do we need to remember about what happens to the variable name when using Compound Assignment?

A

the new value becomes assigned to the variable name. It doesn’t just compute it to find the answer.

(ex)
a = 2 
a + 2 = 4
console.log(a) 
2

b = 6
b += 2 = 8
console.log(b)
b = 8

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

How do we use Compound Assignment with multiplication?

A

*=

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

How do we use Compound Assignment with division?

A

/=

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

what are three different things that can enclose a string?

A

single quotes ‘ ‘
double quotes “ “
backticks ` `

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

When we are using double quotation marks to enclose a string, how do we use double quotation marks inside of our string without the engine interpreting it as the end of the string?

A

You use the escape character \ before the inside “ - this tells the engine that they are just quotation marks and not the end of the string.

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

what is a literal string?

A

it’s a group of characters that are enclosed in single, double quotes pr backticks. The engine doesn’t interpret anything inside the sting until it receives a matching closing quotation mark.

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

When using single quotation marks to enclose a sting, how do we use single quotation marks inside of our string without the engine interpreting it as the end of the sting?

A

You use the \ escape character, in the same way you would with double quotes.

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

what if you use one type of quotes to enclose a literal string and another type of quotes inside the string?

A

Then there is no problem. You do not need to use an escape character.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Can we use backticks to enclose a string with single and double quotes inside them?
Yes we can
26
Recommended way to enclose a string?
with single quotes if you don't a specific reason to use double or backticks
27
How do you escape a backslash in a string? And what does it do?
\\ when you add a single backslash in a string it doesn't show up when you render it. Escaping a backslash by using \\ makes a single backslash appear.
28
What does the escape character \n inside of a string do?
it puts whatever that follows it inside the string on a new line. (ex) happy = 'I want to \n be happy ' (result) 'I want to be happy'
29
what does the escape character \t inside of a string do?
it takes a tab space inside of the string
30
What is concatenating?
its adding two strings together end to end string = "I need to start " + "doing this regularly" console.log(string) "I need to start doing things regularly" or we can do this ``` run = ' i want to do' walk = ' what i want to do ' ``` run + walk = ' i want to do what i want to do '
31
What should we make sure we do when we are concatenating two or more strings as far as spacing?
we should make sure that there is space on the ends of the strings, so when it renders there is a space between them and looks normal and not smashed together. "i want to " + "go home" = 'I want to go home' 'i want to' + 'go home' = 'i want togo home'
32
Concatenating with Combined Assignment?
Just like you can add variable names to numerical values, to create new values for the variable names. you can also do that with strings as well. myStr = ' i went home' += ' so i could sleep' myStr = ' I went home so i could sleep'
33
How can we concatenate strings inside of other strings?
the same way we add other forms of strings, with the + operator. ``` myName = 'Rashaan' greeting = ' Hey how are you' + myName + ' How have you been?' ``` console.log(greeting) " Hey how are you Rashaan How have you been?"
34
How can we find the length of a string?
variableName.length ``` var name = ' rashaan' name.length ``` 7
35
What does the number return on .length signify?
the number of characters in a string
36
what is indexing in a string?
its the built in function by the engine that assigns every character in a string a numerical value.
37
What is the first character in a string indexed as? (i.e. What does javascript start counting with?)
0. rashaan 0123456 So the character length will come back as 7 but the actual count of the index will go up to 6 only because counting starts at 0
38
how do use Bracket Notation to find specific index of character in a string?
variableName[number} the corresponding number will find the character that matches it and return it. name = 'rashaan' name[0] r name[3] h name [6] n
39
What does immutable mean?
it means once something has been set, it is unable to be changed
40
Are the characters in strings mutable or immutable?
The characters in strings are immutable, they cannot be changed once they have been set. (ex) name = 'danny' name[0] = 'm' this will not result in 'manny' because characters inside of strings cannot be changed once they have been set. This will result in an error
41
Are whole strings immutable when assigned to variable name?
No, you can change the value to a variable name as much as you want. name = 'rashaan' console.log(name) name ='jenan' console.log(name)
42
How do we use Bracket Notation to find the last character in a string? Especially if you don't know how many letters there are in a string?
variableName [variableName.length -1] name = 'rashaan' name[name.length - 1] 'n'
43
What is 'n' or 'nth' number?
is it just a placeholder for an unidentified number or number value
44
How to use Bracket Notation to find the 'nth - last' character in a string?
You use the same syntax as finding the last character in a string, except you change the - 1 to a higher integer. name = 'rashaan' name[name.length - 3] 'a'
45
What is the value set to a string or a name that has not been declared to a keyword? (var, let, const etc.)
not defined
46
when using the additional operator to concatenate multiple parameters representing strings, what should we keep in mind as far as spacing?
We have to make sure that not only do we put spacing in between our strings inside of the opening and closing quotes, but we also need to make sure that we are putting spaces in between the parameter names. We do this using empty strings between the parameters. result = " The " + adjective + noun + verb " home" console.log(result( 'funny', 'boy', 'ran')); The funnyboyran home result = " The " + adjective + " " + noun +" " + verb " home" console.log(result( 'funny', 'boy', 'ran'));
47
When using multiple parameters in a function and then setting arguments to those parameters, what do we need to keep in mind when it comes to placement to ensure the proper order takes place in our desired code?
The order in which we put the arguments has to match the location of the parameter ``` function wordBlanks ( param 1 , param 2){ return param 1 + param 2} console.log(wordBlanks( "dog", 'house') console.log(wordBlanks( 'house, 'dog') ``` doghouse housedog
48
What do arrays always start and end with?
a bracket | [ array ]
49
What do arrays always start and end with?
brackets | [ array ]
50
what are the elements inside of an array separated with?
a comma | [ element1, element2]
51
Can arrays contain elements of different data types inside of them/
yes [ "Austin", 3.16]
52
Can you use arrays inside of other arrays?
yes, arrays are allowed to contain arrays
53
What is a Nested Array?
It is an array that is inside of another array nestedArray = [["Giants", 25], [49ers, 16]]
54
Can we use Bracket Notation in an array to index particular elements?
yes we can, ourArray = [50, 60, 70] ourArray[0] returns 50
55
What is the difference between indexing a character in a string, and indexing an element in an array, as far as the value that is returned?
string indexing only gives the character array indexing gives us the whole element and not just a specific element character. string = 'rashaan' string[0] = 'r' array = [50, 60, 70] array[0] = 50
56
How do we modify array data with indexes? Are arrays immutable?
No, they are not immutable. The way we couldn't change a character in a string once it has been set, we can do in an array. ``` niners = [ 33, 43, 55] niners[2] = 16 ``` niners = [33, 43, 16]
57
What are Multi-Dimensional Arrays?
Arrays with multiple arrays inside of them. They are an array of arrays multi = [[1,2,3],[4,5,6],[7,8,9]]
58
How do we use Bracket Notation to index in Multi-Dimensional Arrays?
we use two seperate brackets. The first indexing the whole array, and then the second to specify the specific element multi = [[1,2,3],[4,5,6],[7,8,9]] multi[2][1]; 8 multi[1][0]; 4
59
How do we index a Nested Array inside of a Multi-Dimensional Array?
You add more bracket indexing to specify which element you want to greater detail. var multi = [[1,2,3],[4,5,6],[7,[8,9]]] multi[2][1][0]; 8
60
How do we append a single or single elements to the end of arrays with push( )?
you add .push( ) to the name of the array and add what you want to be added to the end of the array inside the parens. happy = ["john", 'dave', 'mike']; happy.push('larry'); happy;  ["john", "dave", "mike", "larry"]
61
How do we append an array or arrays to the end of arrays with push( )?
add .push( ) to the name of the array and an array or arrays inside the parens with the included [ ]'s sad = ['sad', 'happy', 'meh'] sad.push(['content','hyped']) sad; ["sad", "happy", "meh", ''content", "hyped")]
62
How do we append an array or arrays to the end of arrays with push( )?
add .push( ) to the name of the array and add an array or arrays inside the parens with the included [ ]'s sad = ['sad', 'happy', 'meh'] sad.push(['content','hyped']) sad; ["sad", "happy", "meh", ''content", "hyped")]
63
What is the pop( ) function used for?
the pop function removes the last element from an array arrayName["austin", 3.16] arrayName.pop( ) arrayName; ["austin"]
64
How do we remove an element from an array, and simultaneously assign it to a new variable name?
use a new variable name plus an assignment operator and the pop function in one line of code arrayName = ['austin', 3.16, 'says i just whooped your ass']; var newVariableName = arrayName.pop( ); arrayName;  ["austin", 3.16] newVariableName; "says i just whooped your ass"
65
How do we remove an array from an array using pop? And how do we assign it to a new variable name?
you use the same method that you would with a singular element
66
What is the shift( ) function?
it works almost exactly like pop( ). But it removes the first element of an array rather than the last element
67
What does the unshift ( ) function do?
unshift works exactly like the push function, except instead of adding an element or an array to the end of an array, it adds it to the front of an array array = ['dog', 'cat', 'wolf']; array.shift( ); "dog" array.unshift('happy'); array; (3) ["happy", "cat", "wolf"]
68
What are functions? What is their purpose?
to create reusable code
69
what does it mean to 'call' a function?
to call it to action, to run the action inside the curly brackets
70
how do you call a function?
use the name of the function followed by parens nameFunc ( );
71
when you create a function, does it automatically run?
no, it will not run until you call it
72
in what way is a function repeatable when it doesn't have any parameters?
It is repeatable but not modifiable, meaning you can run it over and over again without having to retype the code. ``` function test( ){ console.log('write this in console') } ``` test ( ) test ( ) test ( ) these three function calls of test ( ) would run the function code three separate times
73
in what way is a function repeatable when it has parameters?
it is repeatable and modifiable. Not only can you repeat the action that the function preforms, but you can modify the input and information that function renders or works with. ``` function newFunc(newStatement){ console.log(newStatement); } ``` newFunc('Hi my name is') newFunc('what?') newFunc('My name is') newFunc('who?') newFunc('chika chika Slim Shady'); result: ``` Hi my name is what? My name is who? chika chika Slim Shady. ```
74
What is a parameter?
a parameter is the place holder in a function that will be modified later when the function is called
75
what is an argument?
an argument is the specified data that will replace the placeholder/parameter when the function is called
76
What does 'scope' refer to?
To the visibility of variables
77
variables that are defined outside of a function block have what type of scope?
Global Scope
78
What does Global Scope mean?
It means it can be seen anywhere in your JS code.
79
variables that are defined inside of a function using the var keyword has what type of scope?
Local scope. The scope is tied to that function. ``` function funcName ( ){ var red = 'blue'; console.log(red);} ``` later in code: red; VM9788:1 Uncaught ReferenceError: red is not defined console.log(red); VM9836:1 Uncaught ReferenceError: red is not defined when running the function: funcName( ); blue
80
variables that are defined inside of a function without using a keyword get what type of scope?
Global scope. ``` function globalScope( ){ red = 'blue'; console.log(red); } ``` The variable 'red' has the value of blue, not only when the function is ran, but when it is put anywhere in the code because it is global globalScope( ); blue red; "blue"
81
What is Local/Block Scope?
Local/Block Scope is when a variable and its value is tied to a function and parameters that it was defined in
82
Is it possible to have Global and Local/Block variables with the same name?
yes you can.
83
when you have a Global and Local/Block variable with the same name, which variable takes precedent when you call a function?
The local/block variable takes precedent. outside of function var outerWear = 'Tshirt'; function ``` function myOutfit( ) { var outerWear = 'sweater'; return outerWear; } ``` Notice that the Local Scope variable only takes precedent when the function is called, and not over the variable name itself in all cases outerWear; "Tshirt" console.log(outerWear); Tshirt myOutfit( ); "sweater"
84
What does the return keyword do?
it creates a return statement in a function that will return a value when the function is ran. ``` function math(a){ return a - 5; } ``` console.log(math(10)); 5
85
Do we need to add return statements to functions?
No we don't have to
86
If we don't have a return keyword in our function and don't specify a value in our function what does it return?
undefined
87
How can we assign a define/declare a variable name to the value of a function?
variableName = functionName(argument); This makes the value of the function assigned to the variable 'num' ``` function inNum(a){ return a + 3; } num = inNum(10); 13 ``` num; 13 Notice that this doesn't affect the future use of the function, the function is just a shell and hasn't been run or called yet. You can still console log it to get a different value console.log(inNum(4)); 7 undefined You can change the argument value and assign it to a different value as many times as you want dude = inNum(1400) dude 1403 man = inNum(500) man 503
88
What are the only two Boolean values?
True or False
89
What does an If statement do ?
it allows you to set one type of code to run if a statement is true and another one if it is false.
90
What is the syntax for an If statement?
``` function functionName { If ( conditional statement){ code ran if statement is true/false} ) ``` var a = 22; ``` function tryIf( ){ if(a === 22) { return ' yeah its true'; } return 'no its all bad'; } ``` tryIf( ); " yeah its true"
91
what does the == operator do?
it checks to see if the variable name contains the same value as the value supplied on the right side of the equality operator ? ``` x = 12; 12 x 12 x == 10 false ``` It checks to see if they are equal regardless of data type (type conversion) ``` 3 == 3 true 3 == '3' true typeof 3 "number" typeof '3' "string" ```
92
what does the === operator do?
it checks to see if the contents of the left and right have not only the same value but also the same data type. (doesn't perform data conversion) 3 === 3 true 3 === '3'; false typeof 3 "number" typeof '3' "string"
93
what is the name of the == operator ?
the equality operator
94
What is the name of the === operator ?
the strict equality operator
95
what is the name of the != operator?
the inequality operator
96
what does the inequality operator do?
it checks to see if both sides of the inequality operator are unequal regardless of data type. ( performs data conversion) if the sides are equal than the return is false, if they are unequal the return is true. x=7; 7 y = 8; 8 x != y true x != x false This also ignores data type, just like the equality operator. So, here we are looking for the return of false indicating that the number data type and the string data type are correctly being attributed the same value. A true statement means they aren't the same value which doesn't indicate that data type conversion is happening. 3 != 3 false 3 != '3' false
97
What is type conversion?
When one data type gets turned into another in order to perform its function
98
What is the name of the !== operator?
Strict Inequality Operator
99
What does the strict inequality do?
it does the exact same thing as the strict equality operator but it looks to see if the values are not equal to produce a true result - and if they are equal to produce a false
100
What is the greater than operator?
>
101
what is the greater than or equal to operator?
>=
102
How do we use a function to create and execute word blanks?
we use a simple function/parameter program : function wordBlanks(noun, adjective, verb) ``` { var result = 'The ' + adjective + " " + noun + " " + verb + ' all the way to the bank' return result;} ``` console.log(wordBlanks('fast', 'boy', 'laughed')); The boy fast laughed all the way to the bank
103
What is the second thing we need to create a function?
The function name function nameFunc
104
What is the third thing we need to create a function?
a set of parens after the function name function nameFunc ( )
105
What is the first thing we need to create a function?
The keyword "function"
106
What is the 5th thing we need to create a function?
code inside the curly brackets, that will run anytime the function is called into action. ``` function nameFunc ( ) { console.log('write this in console') } ```
107
what is declaring a variable?
giving it a variable name var myName
108
what is assigning a variable?
giving the variable name a value myName = 'rashaan'
109
What is the 4th thing we need to create a function?
curly brackets function nameFunc ( ) { }
110
what is the lesser than operator?
111
what is the lesser than or equal to operator?
<=
112
How do we write the 'And' Logical Operator?
with double ampersands
113
What does the 'And' Logical Operator do?
It checks to see if both statements on either side of the operator are true. If one or both sides of the operator return false the whole statement will be false
114
How do we write the 'OR' Logical Operator?
||
115
What does the 'OR' Logical Operator do?
It checks to see if at least one of the expressions one either side of the logical operator are true, if at least one side of the operator is true than the whole expression is true. ``` x = 23 y = 55 ``` x === 23 || y === 2; true
116
How should we think about what a if statement is saying?
If this ..... do that
117
How should we think about what an Else If statement is saying?
And if also this...... then do that too
118
How should we think about an Else statement?
If none of that...... then just do this instead
119
what should we keep in mind in regards to order when we are running if/else if/else statements?
The code stops running at its first true, so the order is important. ``` function test(val){ if ( val < 10){ return 'less than ten'; } else if (val < 5){ return 'less than five'; } } ``` test (3); "less than ten" Notice that the value that was returned was "less than ten" because 3 is less than 10 which is true, but its also less than 5 -- but that result did not run... this is because once the first true is found, the code stops running. Its important that we write our code to get the most precise version of what we want in our code. ``` function test(val){ if ( val < 10){ return 'less than five'; } else if (val < 5){ return 'less than ten'; } } ``` test(3); "less than five
120
What can we use instead of chained if statements?
switch statements
121
What is a switch statement and what does it do?
it tests the value and has many case values that define many possible values
122
What is the syntax of a switch statement with 3 cases?
``` function learnSwitch(val){ var output = ""; switch(val){ case 1: output = 'a'; break; case 2: output = 'b'; break; case 3: output = 'c'; break; default: output = 'unfound'; break; } return output; } ``` learnSwitch(1); "a" learnSwitch(2); "b"
123
What does the break keyword do in a switch statement?
it stops the code from running when it finds a match and jumps outside of the statement and continues running the rest of the code
124
If statements are good to be used when?
when there limited number of possibilities to be returned, like true/false
125
Switch statements are good to be used when ?
when you have code that has a lot of different possibilities or outcomes that are possible
126
if we use a const keyword to create a variable containing an array, can we still modify it with push and pop? shift and unshift methods?
yes you can, it will not come up as an error, it will add the values without error.. But if you try to take the variable name and apply it to a different data type or a different/empty array it will come up as an error
127
what do we use the .slice( ) method for on an array?
its kinda like pop and shift, where it takes off part of the original array and creates a new array out of it. The difference with slice is that it doesnt have to be the beggining or the ending of an array. You can set where the new array begins and ends - note that the last index point isnt counted
128
what happens if you use .slice( ) with no arguments?
it copies the whole array
129
what is .sort ( ) used for in an array?
to sort the elements inside of the array
130
when we use sort( ) with arrays that contain strings?
it sorts them by alphabetical order
131
what happens when you use .sort ( ) . reverse( )?
it reverses order that the array is sorted in
132
what happens when we use .sort( ) on arrays with numerical elements?
it sorts them, but not in the way that you think, all 1's are sorted, then all 2's , then all 3's and so on. 1, 13, 145, 20, 27, 275, 29000, 3, 32 notice 145 come before 20 - this is because 145 starts with 1 and one comes before the digit 2....it sorts in the same way an alphabetical sort happens - meaning it doesn't consider the value
133
can .reverse( ) be used on an array by itself?
yes it can, it doesn't need to be used with .sort
134
how do we put a numerical array in numerical order?
array.sort(function(a,b){ | return a - b});
135
how do we put a numerical array in a descending numerical order?
you switch the position of a - b in the sort function
136
what are anonymous functions?
functions that have no function name
137
what does .map( ) do?
it creates a new array by applying a function individually to every single element in the array. ``` function double(num){ return 2 * num }; ``` ``` const myNumbers = [1,2,3,4]; const doubledNumbers = myNumbers.map(double); ``` doubledNumbers; (4) [2, 4, 6, 8]
138
example of using arrays and .map( ) to create html lists and ul tags
const steps = [ 'wash', 'rinse', 'repeat']; ``` const stepsElements = steps.map(function(step) { return `
  • ${step}
  • `; }); ``` ``` console.log(`
      ${stepsElements.join('\n\t')}
    `); //
      //
    • wash
    • //
    • rinse
    • //
    • repeat
    • //
    ```
    139
    What does .foreach( ) do?
    like .map ( ) it also applies a function to each element of an array, the difference is -- is that it doesn't return the elements in an array. const directionsLibrary = ['wash', 'rinse', 'repeat']; ``` function saveDirectionInDatabase(direction) { // save the direction in the database console.log(direction); } ``` ``` directionsLibrary.forEach(saveDirectionInDatabase); // -> // 'wash' // 'rinse' //'repeat' ```
    140
    what does the .filter( ) method do?
    This method is used to take one array of items and make a new one that contains only items that a filtering function returns true for. ``` function isEven(num) { return num % 2 === 0; } ``` const myNumbers = [1, 2, 3, 4, 5, 6]; ``` const evens = myNumbers.filter(isEven); console.log(evens); // => [2, 4, 6] ```
    141
    what does the .reduce( ) method do ?
    The reduce ( ) method reduces all the elements in an array into a single value. This is regardless of data type ``` function sum(total,num){ return total + num;}; ``` array = [ 1, 3, 4, 6] (4) [1, 3, 4, 6] array.reduce(sum); 14 or newArray = ['jerry', 'dave', 'larry'] newArray.reduce(sum); "jerrydavelarry"
    142
    what is a default statement in a switch statement?
    is where you can set a default return value for a switch statement in the event none of the other case options are found
    143
    What can you do if you want multiple case options to return the same value?
    just do not use the break in between those different cases ``` switch(x){ case 1: answer: blah blah blah break; case 2: case 3: answer: more blah blah break; case 4: answer: final blah blah blah break; } return x } ``` In this code, 2 and 3 will return the same input, if its two it will pass along til the third and give the output as if it were case 3
    144
    Do we need to use number values for assigning a case in a switch statement?
    No we do not we can use strings too case: "bob" works just fine
    145
    What do we use .find ( ) for?
    We use it to find the first element in an array that turns back a true statement.. ``` function isEven(num) { return num % 2 === 0; } ``` ``` const Numbers = [1, 3, 4, 5, 6]; Numbers.find(isEven); ``` 4..
    146
    What happens when you use .find ( ) and none of the elements return a true statement?
    It returns an undefined statement
    147
    when you add an item to an array and return the expression containing the .pop( ) what does it return?
    it returns the length of the new array -- not the actual array itself
    148
    how do you return the actual array after modifying it in some way?
    call, return or console.log the actual name of the array
    149
    what should we keep in mind when we want a function to return a true or false statement?
    all comparison operators return a true or false statement so sometimes instead of using if statements we can just use a comparison operator instead if applicable
    150
    what do all comparison operators return?
    a boolean value ... true or false
    151
    in what way are objects different than arrays when it comes to accessing data?
    objects use properties to access data instead of indexes
    152
    if arrays are enclosed by brackets, what are objects enclosed by?
    curly brackets Array array = [ ] Object object = { }
    153
    In an object, what goes before the colons?
    the properties ``` var myDog = { "name" : ```
    154
    in an object, what goes after the colons?
    the values to the properties ``` var myDog = { "name": "Rex", ```
    155
    what data types can be values of an object?
    any data type in javascript
    156
    What is Dot Notation?
    Dot notation is a way to access an objects property value, by its property. ``` var testObj = { "hat": "ballcap", "shirt": "jersey", "shoes": "cleats" }; ``` ``` testObj.hat "ballcap" testObj.shirt "jersey" testObj.shoes "cleats" ```
    157
    what do we put between different property/value pairs on an object?
    a comma
    158
    what is the syntax of dot notation?
    objectName.propertyname
    159
    how do we use bracket notation to access an object?
    we use it the same way we would with an array testObj["hat"]
    160
    when must we use bracket notation over dot notation when accessing data of an object?
    when the property name has a space in it
    161
    How can we assign a variable name to a object property value? whats the syntax?
    by using bracket notation or dot notation var newValueName = objectName[propertyName} var newValueName = objectName.propertyName
    162
    Can we assign a variable name to an object property value using both dot notation and bracket notation?
    yes we can
    163
    how can we update object properties using dot notation?
    objectName.PropertyName = "new property name" Example ``` nfl = { packers : 'farve', niners : 'montana', pats : 'brady' }; ``` nfl.packers = 'rodgers' nfl {packers: "rodgers", niners: "montana", pats: "brady"}
    164
    how can we update object properties using bracket notation?
    objectName["propertyName"] = "new value" nfl {packers: "rodgers", niners: "montana", pats: "brady"} nfl["niners"] = "rice" nfl {packers: "rodgers", niners: "rice", pats: "brady"}
    165
    how do we delete a property from an object?
    by using the delete keyword nfl {packers: "rodgers", niners: "rice", pats: "brady"} delete nfl.pats nfl {packers: "rodgers", niners: "rice"}
    166
    how do we check to see if a object has a particular property?
    objectName.hasownproperty(propertyname) nfl {niners: "San Francisco", packers: "Green Bay", raiders: "Oakland", lions: "Detroit", Giants: "New York", …} nfl.hasOwnProperty('niners'); true
    167
    what does a .hasownproperty( ) return?
    a boolean value -- true or false
    168
    what to objects allow us to do?
    allows us to store flexible data
    169
    can we put an object inside of an array?
    yes we can
    170
    how do we access nested objects?
    use dot notation ``` var house = { "bedroom" : { "inside": "bed", "outside": "stairs"}, "livingroom" : { "inside" : "stove", "outside" : "dining room"} }; ``` ``` examples house.bedroom.inside "bed" house.bedroom {inside: "bed", outside: "stairs"} house {bedroom: {…}, livingroom: {…}} ```
    171
    How do you access a nested object if one of the properties has a space in it?
    use bracket notation on that property. ``` var house = { "bedroom" : { "inside": "bed", "outside": "stairs"}, "living room" : { "inside" : "stove", "outside" : "dining room"} }; ``` house["living room"].inside "stove"
    172
    can we use dot notation in conjunction with bracket notation when you have objects nested inside of arrays?
    yes you can ``` var myPlants = [ { type: "flowers", list: [ "rose", "tulip", "dandelion" ] }, { type: "trees", list: [ "fir", "pine", "birch" ] } ]; ``` myPlants[1].list[1]; "pine" myPlants[0].list[2] "dandelion"
    173
    what is a loop?
    loops allow you to run the same code multiple times
    174
    what is a while loop?
    a while loop runs while a specified statement is true and stops once its no longer true for example ``` var myArray = [ ] var i = 0 ``` while(i < 5){ myArray.push(i); i++; }; myArray (5) [0, 1, 2, 3, 4] we set the i variable to zero and used the push method to add it to myArray. Then we used ++ to increase it by one every time it got ran in a loop. Then we set it to <5, so it increased by one until the statement was no longer true, ie until it was no longer less than 5. This leaves us with a 5 character array increasing by one digit under the total value of 5
    175
    what are the 4 parts of a for loop?
    1. the initialization 2. the condition 3. the final act 4. the actual code ran
    176
    what part of the for loop happens before any other part of the code runs?
    the initialization. this is the starting point of the loop
    177
    what is the second part of the for loop for?
    as long as this part returns as true, the loop will keep going
    178
    what is the final act in the for loop?
    this one says what will actually happen in the loop
    179
    an example of how to use the for loop
    ``` var touchdown = []; undefined for (s = 7; s < 63; s++){ touchdown.push(s); }; 56 touchdown (56) [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62] ```
    180
    when should we use for loops?
    when we have a code we want to run a set number of times
    181
    when should we run a while loop instead of a for loop?
    when we dont have a set number of times that we want to run a code, but we want to run it as many times as possible until the condition is no longer true
    182
    if in a while loop there is a condition that will always true how would the code ever get out of running it?
    it will stop running if there is an if statement that has a statment that runs as true and then a break statement after it. this true if statement and this break statement will break it out of the loop
    183
    what is variable scope?
    Variable scope defines how the variables you declare either can or cannot be accessed at different places in your code..
    184
    variables using the keyword 'let' and 'const' have what two different types of scope?
    Global and Block
    185
    What does it mean when a variable has global scope?
    it is available everywhere in your code
    186
    Any variable that is declared outside of a function gets what type of scope?
    it gets global scope
    187
    what is block/local scope mean?
    hat means that it is only accessible within the function's block of instructions. When the function has finished executing, this new variable disappears.
    188
    does local or block scope variables affect global scope variables?
    No they dont
    189
    what is the scope chain?
    JavaScript follows the scope chain to determine the value of the variable. First, it looks in the current scope to see if there's a variable with that name. If that variable name is not defined locally, the JavaScript interpreter will look in the parent scope of the function to see if the variable is defined there, and if it is, it will use that value. The interpreter will continue looking "up" the scope chain until it reaches the global scope, and if it doesn't find the variable defined there, it will raise an Uncaught ReferenceError indicating that the code refers to a variable that's not defined.
    190
    what takes precedence when two variables share a name?
    when you define a variable in a function that has the same name as a variable in the global scope, the local variable will take precedence over the global one
    191
    When a local or block scope variable takes precedence over a global scope variable, what is a name that is often used for this process?
    variable shadowing
    192
    Does Global scope extend across files?
    yes it does, meaning you can access it in multiple js files even if it isnt defined in that particular file
    193
    What is a side effect?
    A side effect is when a function reaches outside its local scope up into a parent or global scope scope and alters a value that lives there.
    194
    are side effects always bad?
    No they are not always bad, as long as they are intended. Unintended side effects are what we want to avoid at all costs
    195
    A combination of global variables along with unintended side affects almost always guarantees what?
    that the code becomes indeterminate.
    196
    What does it mean when code is indeterminate?
    it is code that — given a single set of inputs — returns one value some times and another at other times. This can lead to frustrating and hard-to-track-down bugs in your code.
    197
    What does it mean when the code is determinate?
    is code that will always return the same value if it's provided with the same inputs.
    198
    When is a function said to be pure?
    when it is determinate and has no side effects
    199
    Should you refer to a global variable name inside of your function?
    No, if you want to use a variable inside a function, define and assign it inside of your function
    200
    Should we always use keywords, let or const or var in our functions?
    Yes , this makes them local/block and wont affect any other variables
    201
    How to apply strict mode to your java file?
    'use strict';
    202
    what will setting your java file on strict mode do?
    When strict mode is enabled, any time a variable is declared without the let or const keyword, an error will be triggered.
    203
    Why is setting your page to strict mode a good idea to always do?
    because this keeps your from accidently modifying code that you don't intend. Like you forget to put a let or const on a block scope variable and accidently make it global and change something you didnt intend
    204
    what are two ways strict mode can be set?
    it can be set for the whole page, by placing at the top of the page, or it can be set for a specific function, by being placed at the top of a function and like a block scope variable it will start and end within that function
    205
    what is an object?
    an object is a complex data structure, used to hold key/value pairs
    206
    what is a key/value pair? how should we think about a key/value pair?
    a key/value pair is kinda like a dictionary and its entries the word is the key and the definition is the value happy: a feeling of content, not sad key value
    207
    what is an object key followed by?
    a colon :
    208
    what follows a key/value pair?
    a comma ,
    209
    what is an object literal?
    it is one way of creating an object... ``` const ledZeppelin = { singer: 'Robert Plant', guitar: 'Jimmy Page', bass: 'John Paul Jones', drums: 'John Bonham' } ```
    210
    Do keys need to have quotations when creating a literal object?
    Most of the time they are not neccesary
    211
    What are examples of times when quotations will be necessary when creating keys of an object literal?
    if you need to add a space in the name of a key or if you need to add a period or something to the key ``` keys with spaces get quotations const ledZeppelin2 = { 'lead singer': 'Robert Plant', 'lead guitar': 'Jimmy Page', } ``` keys without spaces or needed punctuation dont ``` const ledZeppelin = { singer: 'Robert Plant', guitar: 'Jimmy Page', bass: 'John Paul Jones', drums: 'John Bonham' } ```
    212
    Can we have multiple keys in an object?
    No, keys in an object must all be unique — that is, each key can be used only once in the object.
    213
    What type of data types can be values of an object key?
    The values in an object can be any valid JavaScript data type. In the example above, all the values are strings, but values can also be numbers, booleans, other objects, null, or functions.
    214
    what do we call a function when it is used as a value for an object key?
    When an object has a value that is a function, we refer to that key/value pair as a method.
    215
    what do we call a function when it is used as a value for an object key?
    an object method. When an object has a value that is a function, we refer to that key/value pair as a method.
    216
    What is another way that you can self reference a key in an object without having to repeat the key itself?
    by using the 'This' keyword ``` const myFamily = { lastName: 'Doe', mom: 'Cynthia', dad: 'Paul', sayHi: function() { console.log(`Hello from the ${this.lastName}s`); } }; ``` myFamily.sayHi() // => Hello from the Does
    217
    When using objects in a function, what do we need to remember about how global scope variable with the same name is affected when it comes to shadowing?
    objects change the global scope variable when used inside of a function after it is ran. ``` function myFunc2(obj) { obj.foo = 'bizz'; console.log(obj.foo); } ``` const myVar = {foo: 'bar'}; console.log(myVar.foo); // => 'bar' myFunc2(myVar); // => logs 'bizz' — that's what we thought would happen! console.log(myVar.foo); // => 'bizz' — ruh roh! change inside function affected outside world!
    218
    what should you keep in mind when passing objects as arguments?
    that there may be unintended side effects in the global scope
    219
    How do you get keys to an object to show up as an array so you iterate through them?
    use object.key( ) and place object name inside of the parens
    220
    How do you get keys to an object to show up as an array so you iterate through them?
    use Object.keys( ) and place object name inside of the parens
    221
    What is a factory function? And what is its job
    a function that returns an object ``` function createObject( ){ return { name : dave, age : 23, job : wrestler, } ```
    222
    what is the similarity between .map and .foreach?
    they both act like a loop and iterate through each item of an array applying a particular function to each one
    223
    what does .foreach return if it doesn't return an array?
    it returns 'undefined'
    224
    what two ways do we apply a function to a .map or a .foreach?
    you can write a code beforehand, or if there is one already written in the code.... you can just pass the function name through as an argument. ``` function double(x){ result = x * 2 return result }; ``` console. log(numbers.map(double)); console. log(numbers.forEach(double)); or you can write an anonymous function inside of the parens ``` console.log(numbers.map(function(x){ newNumbers = x * 3; return newNumbers; }) ) ``` ``` console.log(numbers.forEach(function(x){ newNumbers = x * 3; return newNumbers; }) ) ```
    225
    what do i need to start remembering to do when i create new values for anything....
    give it a new variable name to access it later
    226
    what do i need to start remembering to do when it comes to producing/returning values...
    using return and/or console.log( )
    227
    when you make an anonymous function do you still need to use return to produce the result inside of a parens?.
    yes you do otherwise it returns as undefined
    228
    what does` ${variable name} ` allow us to do?
    it allows us to insert a value (regardless of data type to be inserted in a string of code) by its variable name. ``` function createString(x){ return ` this is a sting with the word ${x} inside of it` }; ``` console.log(createString('apples')); this is a string with the word apples inside of it
    229
    when using anonymous functions to pass arrays with items already set, do we need to pass an argument or arguments when we are writing our code inside the parens?
    no we don't, the array already has preset array items that will work work as arguments. This is true for things like .map and .foreach that are already designed to loop or iterate through an existing array
    230
    do we need to add the array name in the parameter of a function?
    no you dont, just need a placeholder text
    231
    when creating a new variable from the result of a function do you need to add the console.log as well?
    no you do not need to add the console.log - when you want to run it you will have to just put console.log(variableName) later in the code when you want to run it
    232
    what function do we use with .reduce either anonymously or by passing function name through as an argument?
    ``` function functionName (a,b){ return a + b} ); ``` or array.reduce(function(a,b){ return a + b} );
    233
    when accessing a data point in an object by bracket notation, does the key need to have quotations inside of the brackets?
    yes it does, otherwise it will come up as an error
    234
    When you need to create a new array within a function how do you do so?
    1. Create an empty array 2. Create a loop. 3. .push( ) to empty array name 4. Return array
    235
    does the footer tag go inside the body?
    yes it does
    236
    when using dot notation in accessing objects do we need to use quotations?
    no you dont, not unless it has spaces
    237
    when using bracket notation in accessing objects do we need to use quotations?
    yes we do
    238
    what type of error will come up if you forget to put a comma in between key/value pairs in an object?
    unexpected string
    239
    what do we call things that we add to arrays to modify them? things like .reduce or .sort or .filter or .map?
    these are called array methods
    240
    when running a object method (function) what do we need to make sure we include when trying to run it?
    the parens ``` const mySquad = { name : '49ers', city : 'San Francsico', record : '8 - 0', chant : function(){ console.log(`Were the ${mySquad.city} ${mySquad.name} Who's got it better than US??!!?! NOOOOOOBODY!!!!`); }, 'superbowl wins': '5', }; ``` console.log(mySquad.chant());
    241
    when running a object method (function) what do we need to make sure we include when trying to run it?
    the parens ``` const mySquad = { name : '49ers', city : 'San Francisco', record : '8 - 0', chant : function(){ console.log(`Were the ${mySquad.city} ${mySquad.name} Who's got it better than US??!!?! NOOOOOOBODY!!!!`); }, 'superbowl wins': '5', }; ``` console.log(mySquad.chant());
    242
    what method can you add to a string to make the all the characters in the string upper case?
    .toUpperCase( )
    243
    what does the method .trim( ) do?
    it takes off the spaces at the beginning and end of strings
    244
    what does the method .toLowerCase( ) do?
    it makes a string all lowercase
    245
    can we put more than one method on one a string or object?
    yes we can, like if we wanted a string to be lowercase and have no spaces on the end you can do something like this string.toLowerCase( ).trim( )
    246
    what is it called when we use multiple methods on a string or on a object?
    its called method chaining
    247
    what is the .find( ) method?
    it takes a function and runs it through each item of the array and returns it only if its true. IT ONLY RETURNS ONE ITEM
    248
    what does the slice array do?
    it creates an array from an existing one. You can call it with parameters and add arguments to decide which index points you want to specifically copy array = [45,6,8,99,62] array.slice(2,3) array = [8,99]
    249
    what happens if you use .slice( ) with no parameters or arguments?
    it copies the whole array
    250
    what happens when you use .slice( ) with negative numbers
    it counts from the end of the array
    251
    can you use the .length method on both strings and arrays?
    yes you can use it on both strings and arrays and it will return the character count. so when trying to access certain items or strings by length you can use this tool on both data types
    252
    how to create a find max number function without using any built in functions ?
    ``` function max(numbers){ let currentValue = numbers[0]; for ( i = 0; i < numbers.length; i++){ if (numbers[i] > currentValue){ currentValue = numbers[i]; } } return currentValue; } ```
    253
    if .pop( ) and .push( ) and shift( ) and unshift( ) already have determined items in an array that it targets, how do we specify which items we want to target if not one of these?
    then we use .slice( )
    254
    when using the .pop( ) method, do you need to add anything inside of the parenthesis to get it to target which items it will remove?
    no you dont, it automatically takes off the last item in an array
    255
    what is something that you can use join( ) for?
    you can use this to add random things to the end of an array like if you want to make the array vertical and not horizontal you can do this array.join('\n') and it will display the array vertically by creating a new line on the end of the items in the array
    256
    when using the method .hasOwnProperty( ) to search for an object key, do we need to put that key in quotations ?
    yes we do, otherwise it will return false even if its actually there
    257
    when using push.( ) to add an array to another array... what happens if we add the variable name for the second array inside of the parens with quotations? array.push("array2")?
    it will just actually add the string to the array and not the array it represents. ['wash', 'rinse', 'repeat', 'array2'];
    258
    when using push.( ) to add an array to another array... what happens if we add the variable name for the second array inside of the parens without quotations? array.push(array2)?
    it will add the second array, but as a nested array, not as apart of the first array. ['wash', 'rinse', 'repeat', ['dry','condition']];
    259
    when using push.( ) to add an array to another array... what happens if we dont add the variable name for the second array inside of the parens and type out the actual items in the array itself? array.push("dry","condition")?
    it will add the actual items to the array without making it a nested array, it will all be one single array
    260
    when using .slice( ) method we know that the second parameter when using a positive number doesn't get included in the new array but includes the item before it. Is this the same when using a negative number to count from the end of the array?
    no, when using a negative number to count from the end of an array, we find that a negative number works exactly like a positive number in the first parameter spot, in that, it includes the item that it represents and doesn't cut off before it.
    261
    when using .slice( ) and with a positive number in the first parameter place and then a negative number in the second parameter place, from which way will it create a new array?
    it will count from the beginning of the array starting from the index represented by the positive number - until it reaches the item represented by the negative number so it will go from left to right
    262
    when using a .slice( ) with a negative number only with no positive number in the first parameter position, how does the method copy its array?
    it counts from the end, until it reaches the item represented by the number and it copies everything from the end to that number
    263
    when using .slice( ) with a positive number only and no other number in the second parameter spot, how does the array get copied?
    it starts from the item represented by that number and then copies everything from that until the end of the array
    264
    when a variable has no value what does it come back as?
    undefined
    265
    when a variable has no keyword what does it come back as?
    not defined
    266
    when you call a function without the parens what will be returned?
    [function]
    267
    what do you need to remember when you're calling an object method?
    the parens ( )
    268
    what happens when you call a object function without parens with either dot or bracket notation?
    it returns [function]
    269
    when you call an object method using dot notation where do you put the parens?
    you put the parens immediately after the name objectname.keyname( );
    270
    when you call an object method using bracket notation where do you put the parens?
    you put the parens after the brackets. objectname[keyname]( );
    271
    when you use push( ) on an array and console log it with the .push method attached, what does it return?
    it returns the character length of the array
    272
    how do you return the actual array after you added an item to it by using .push( )
    you console.log or return the name of the array itself not with push( )
    273
    how to create an array without just typing it yourself?
    ``` create a function create empty array with name create for loop result the push method on to the array name return array name ```
    274
    when accessing objects inside of array using a call back functions in a array method like .map( ), how do we specifically target individual keys inside of the various objects?
    we give the function a parameter name, then use that dot or bracket notation on that parameter name and then target the desired key. ``` arrayOfObject = [ { name : dave, city : detroit, brothers : 4, }, { name : chris, city : boston, brothers : 1, }, { name : sarah, city : memphis, brothers : 0 }, ] ``` arrayOfObject.map(function(person){ return person.name}; when we call this function, the map method will automatically run through each item. When we put person.name inside of the curly brackets, the engine will read that it is a parameter and realize that it is an object key because dot notation only goes on object keys. So when it finds that it will return all the names of each object in a new array, because map returns a new array
    275
    what does a for/in loop do?
    loops through the properties or keys of an object
    276
    when using Object.keys( ) on an object does it change the original object to an array?
    no the original object will stil be an object?
    277
    how do we take an object and make it an array and make it accessible later?
    you create a new variable name and use object.keys( ) var array = Object.keys( )
    278
    when you use object.keys( ) on an object? what is returned as an array? the keys? the values? both?
    the keys only
    279
    if we want to access a specific key in an object? how do we do so ?
    var newVarName = Object.keys( object)[n]; console.log(newVarName); key;
    280
    can you add array methods like .sort( ) and .push( ) to parameter names in anticipation that the parameter passed will be an array or an object?
    yes you can.
    281
    what is the answer to the student report drill where you had to take an array of objects and produce an array of strings with student name and grades being returned ?
    ``` function makeStudentsReport(data) { let array = []; for (i = 0; i < data.length; i++){ let item = data[i]; array.push(`${item.name}: ${item.grade}`) } return array; } ```
    282
    what is the solution to the enroll in summer school drill where the objective is to take an array of objects and return the name and course as the same as the original objects but change teh status to in summer school using a loop?
    ``` function enrollInSummerSchoolAlt(students) { const results = []; for (let i = 0; i < students.length; i++) { results.push({ name: students[i].name, status: 'In Summer school', course: students[i].course, }); } return results; } ```
    283
    what is the solution to the enroll in summer school drill where the objective is to take an array of objects and return the name and course as the same as the original objects but change the status to in summer school WITHOUT using a loop?
    ``` function enrollInSummerSchool(students){ return students.map(function(student){ return { name : student.name, status : 'in summer school', course : student.course} ``` }) }
    284
    When using dot or bracket notation on one of an object’s keys - what will be returned?
    The value of that key.
    285
    what is the answer to the findbyID drill where the objective is to look in an array of objects and create a fucntion with two parameters, one paremeter is the array of objects and the second parameter is the idNum that were looking for. We want to find the item inside all the objects that has a particular idNum
    ``` function findById(items, idNum) { return items.find(function(item){ return item.id === idNum }); } ```
    286
    what is the answer to validate keys drill , where the objective is to create a function with two parameters, one parameter is an object, the second parameter is the 'expected keys' you want to find in the object. validateKeys should return true if object has all of the keys from expectedKeys, and no additional keys. It should return false if one or more of the expectedKeys is missing from the object, or if the object contains extra keys not in expectedKeys.
    ``` function validateKeys(object, expectedKeys) { if (Object.keys(object).length !== expectedKeys.length) { return false; } for (let i = 0; i < expectedKeys.length; i++) { if (!Object.keys(object).find(key => key === expectedKeys[i])) { return false; } } return true; } ``` ``` // if there's not the same number of object keys // and expected keys, then we know there are missing or // extra keys, so return false // we iterate over each expected key and verify that // it's found in `object`. // if we get to this point in our code, the keys are valid // so we return `true` ```
    287
    when creating a function that creates an array, there is a point where you will use the push method on to the array name. During this, do we need to add the 'return' key?
    No, using the 'return' key at this point will not return an array, even if the rest of the code is correct. use the 'return' key on the array name after push has been used.
    288
    when using a function to create an array, when do we put the 'return' key in the function to produce an array?
    use the 'return' key on the array name after push has been used. not on the .push( ) method
    289
    when ever you need to create a loop and increment or decrement by more than i++ or I--, how do we structure the third and final part of the loop?
    with compound assignment operators i += 10
    290
    why must we use compound assignment operators when creating loops that increase or decrease by more than one?
    because when you use a compound assignment operator, the variable (i) gets saved as the new value, and then runs in the loop again. when you just use + or something, the loop goes back to where ever the original variable started ( i = 0), meaning that the loop will just keep looping and never be terminated because it will never reach the second part of the loop ( < array.length). meaning it wont produce anything and will just run and run.
    291
    Can you use bracket notation on the object name itself?
    No, you can use it on the keys and the values but you cannot use it on the object name itself. [object]name will not work; you would have to go object['name'] or object.name
    292
    How can you take a float number (with decimals) and round it down to the whole number?
    Save the number to a variable name Use Math.floor(variable name) on that variable
    293
    How do you find the index of an array using an array method?
    Use indexOf( array name )
    294
    Why would you use an array method to find the index of an array item instead of just counting?
    Because you don’t always know what’s in an array, or an array might to be too big to count
    295
    Does indexOf( ) tell you every occurrence of the searched for array item?
    No it only tells you the location of the first occurrence
    296
    What if you know the index of an item in an array but want to see the index of others or another later in the array?
    Use index of method, put item value you’re looking for and select what index method you want it to start counting from. animals.indexOf(‘dog’,10) This will look for the first item named dog in the array named animals starting from counting at index 10. Any item named dog before index 10 of animal array will be ignored
    297
    What happens if you use, indexOf( ) and search an array item that isn’t present in the array you are looking in?
    It will return the index of -1
    298
    when you use shift on an array what does it return?
    it returns the value of the item that has been removed off of the front of the array
    299
    How can we check to see if an array has a particular item in its array?
    array.includes( )
    300
    Can we check if an item is in an array, beginning from a certain point?
    Yes, array.includes( item, 2) This will start looking from index position 2
    301
    How do you add two arrays together so they become one and are not nested in one another?
    array.concat(‘array2’)
    302
    How to return the character code of a character?
    Character.charCodeAt( ); e.charCodeAt( );
    303
    What does the ** operator do?
    It multiplies by the power of.. 5**2 Is 5 to the second power.
    304
    How do we check the data type of a variable?
    By using ‘typeof’ typeof variable name
    305
    How do we make a parameter or any form of input case INSENSITIVE ?
    Add .toLowerCase() to the parameter and/or the input to change the whole string to lower case and make it so the typing of CASE doesn’t matter