JS LOOPS Flashcards
What is the purpose of a loop?
It executes codes repeatedly
What is the purpose of a condition expression in a loop?
Loops run only until the condition expression is false.
It is like a stop
What does “iteration” mean in the context of loops?
when code is ran through once
When does the condition expression of a while loop get evaluated?
The condition is evaluated before executing the statement.
When does the initialization expression of a for loop get evaluated?
At the beginning once
When does the condition expression of a for loop get evaluated?
In middle after initialization
When does the final expression of a for loop get evaluated?
before the next conditional
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
break
What does the ++ increment operator do?
It keeps a counter, adds 1
How do you iterate through the keys of an object?
for in loop