JavaScript If Conditionals and Loops Flashcards

1
Q

Give 6 examples of comparison operators.

A
> Greater Than
< Less Than
>= Greater Than Or Equal To
== Two Values Are The Same
=== Strictly Equal To (Same data type and value)
!= Not Equal
!== Strict no equal
% Remainder
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 Values

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

If a condition is met, then then subsequent statements are executed in the code block

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

No

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

What are the three logical operators?

A

&& - Logical and, tests more than one condition

|| Logical or, tests at least one condition.

! - Logical Not, tests Takes a single Boolean value and inverts it.

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

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

A

Using Logical and &&

Logical or ||

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

What is the purpose of a loop?

A

They offer a quick and easy way to do something repeatedly.

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

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

A

The condition is about where the loop starts or stops

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

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

A

Every time the process happens, that is the iteration

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

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

A

Before each iteration

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

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

A

Before ANYTHING in the for loop

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

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

A

Before each iteration in the for loop

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

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

A

After the loop code block has run

This happens before we return to the condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
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
15
Q

What does the ++ increment operator do?

A

It adds and assigns 1 to the variable and becomes a new value

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

How do you iterate through the keys of an object?

A

You use the for…in loop