JAVASCRIPT Flashcards

1
Q

What is the purpose of variables?

A

to store or remmeber information

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

How to declare a variable

A

var and name of variable

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

How do you initialize (assign a value to) a variable?

A

=

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

What characters are allowed in variable names?

A

$, any character, _, a number as long as its not in the beginning

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

What does it mean to say that variable names are “case sensitive”?

A

that capital letters affect it

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

How do you update the value of a variable?

A

re declare them

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

What is the difference between null and undefined?

A

null is put there by a programmer undefined is there in the absence of anything

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

Why is it a good habit to include “labels” when you log values to the browser console?

A

for readability

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

What data type is returned by an arithmetic operation?

A

number

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

What purpose(s) does the + plus operator serve in JavaScript?

A

concatination and addition

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

What data type is returned by comparing two values (, ===, etc)?

A

boolean type

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

What does the += “plus-equals” operator do?

A

adds the value to the current value and reasign the variable

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

What are objects used for?

A

to combine like information

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

What are object properties?

A

allow you to store information

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

Describe object literal notation.

A

var object ={}

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

How do you remove a property from an object?

A

delete operator

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

What are the two ways to get or update the value of a property?

A

. or []

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

What are arrays used for?

A

store a list of items

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

Describe array literal notation.

A

var array =[];

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

How are arrays different from “plain” objects?

A

objects have properties arrays don’t

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

What number represents the first index of an array?

A

0

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

What is the length property of an array?

A

the number of values in array

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

How do you calculate the last index of an array?

A

length -1

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

What is a function in JavaScript?

A

an set of instructions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Describe the parts of a function definition.
function name (parameter){code block}
26
Describe the parts of a function call.
name of function and argument
27
When comparing them side-by-side, what are the differences between a function call and a function definition?
function definition defines the function. function call is calling the function
28
What is the difference between a parameter and an argument?
parameter is just to hold value and has no value. | argument has a value.
29
Why are function parameters useful?
it can be re used with different arguments
30
What two effects does a return statement have on the behavior of a function?
it will return code outside of the function, and stops code from running after it
31
Why do we log things to the console?
to debug
32
What is a method?
a pre defined function which is a property of an object
33
How is a method different from any other function?
you can only input arguments on methods, you can modify functions and how they work
34
How do you remove the last element from an array?
.pop()
35
How do you round a number down to the nearest integer?
Math.floor()
36
How do you generate a random number?
Math.random()
37
How do you delete an element from an array?
splice
38
How do you break a string up into an array?
split
39
Do string methods change the original string? How would you check if you weren't sure?
no strings are immutable console.log
40
Roughly how many string methods are there according to the MDN Web docs?
30
41
Is the return value of a function or method useful in every situation?
depends not every situation
42
Roughly how many array methods are there according to the MDN Web docs?
30ish
43
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
mdn
44
What data type do comparison expressions evaluate to?
boolean types
45
What is the purpose of an if statement?
to make a decision
46
Is else required in order to use an if statement?
no
47
Describe the syntax (structure) of an if statement.
if (){}
48
What are the three logical operators?
if, else, if else
49
How do you compare two different expressions in the same condition?
|| &&
50
What is the purpose of a loop?
check condition and run code block multiple times
51
What is the purpose of a condition expression in a loop?
the thing that says start or stop
52
What does "iteration" mean in the context of loops?
being repeated
53
When does the condition expression of a while loop get evaluated?
before each iteration
54
When does the initialization expression of a for loop get evaluated?
before loop starts
55
When does the condition expression of a for loop get evaluated?
before initial iteration
56
When does the final expression of a for loop get evaluated?
at the end after iteration
57
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
break
58
What does the ++ increment operator do?
increments by 1
59
How do you iterate through the keys of an object?
for in loop
60
what does the substr() method do
returns a portion of the string, starting at the specified index and extending for a given number of characters afterwards