javascript-loops Flashcards

1
Q

What is the purpose of a loop?

A

to make a repetitive process quicker and easier

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

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

A

it dictates when the loop will be exited. “when should i stop”

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

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

A

one iteration occurs everytime the condition is reevaluated. an iteration is everytime the loop code block gets checked by the computer and is sent to reevaluate the condition. an iteration can be though of one full loop over the lines of code.

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

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

A

before code block runs on each iteration

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

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

A

it is the first stop upon entering the for loop

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

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

A

after the code block and before the condition is checked

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

What does the ++ increment operator do?

A

it adds one to the value of the variable next to it

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

How do you iterate through the keys of an object?

A

for in loops

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