javsacript-if Flashcards

1
Q

Give 6 examples of comparison operators.

A

<
>
>=
<=
===
strictlynotequal

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

What data type do comparison expressions evaluate to?

A

boolean true or false

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

What is the purpose of an if statement?

A

to create pathways for decision making

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

Is else required in order to use an if statement?

A

else is not required for if but if is required for else

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

How do you compare two different expressions in the same condition?

A

use logical operators. logical and(&&) or logical or (||)

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

What is the purpose of a loop?

A

to easily perform a repetitive action

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

What is the purpose of a condition expression in a loop?

A

to tell the loop when to stop

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

What does “iteration” mean in the context of loops?

A

one full cycle

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

When does the condition expression of a while loop get evaluated?

A

right before the loop is about to be entered

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

When does the initialization expression of a for loop get evaluated?

A

it’s the first piece of the if statement to be evaluated and only gets evaluated once

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

When does the condition expression of a for loop get evaluated?

A

before the code block is entered but after the final expression

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

When does the final expression of a for loop get evaluated?

A

after the code block but before the condition expression

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

Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?

A

break

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

What does the ++ increment operator do?

A

adds 1 to the variable on its left

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

How do you iterate through the keys of an object?

A

by using a for in loop

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