Javascript-loops Flashcards
What is the purpose of a loop?
Automatically repeating a block of code exponentially and quickly on each value for a subset of data.
What is the purpose of a condition expression in a loop?
How many times a loop should run or to know when to exit a loop else it will run forever
What does “iteration” mean in the context of loops?
Number of times it runs
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 loop starts.
When does the condition expression of a for loop get evaluated?
Before each loop iteration and after the final expression
When does the final expression of a for loop get evaluated?
After executing the code block, at the end of each loop iteration.
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?
Add one to the existing value
How do you iterate through the keys of an object?
for…in loop.