javascript-loops Flashcards
What is the purpose of a loop?
To execute code a certain number of times
What is the purpose of a condition expression in a loop?
It is an expression to be evaluated before each loop iteration.
What does “iteration” mean in the context of loops?
Number of times the code executes
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?
Once before the execution of the code block
When does the condition expression of a for loop get evaluated?
If the condition is true, it is executed. Test is optional. If false, execution skips to the first expression following the for construct.
When does the final expression of a for loop get evaluated?
An expression to be evaluated at the end of each loop iteration. Before the next evaluation of condition.
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
Condition statement
What does the ++ increment operator do?
Increments by one
How do you iterate through the keys of an object?
Use a for - in loop