javascript-loops Flashcards
What is the purpose of a loop?
To run a code block multiple times will the condition is true; repeat an action some number of times
What is the purpose of a condition expression in a loop?
It tells the loop to run until the counter reaches the specified number
What does “iteration” mean in the context of loops?
Each single pass through the sequence to complete the loop
When does the condition expression of a while loop get evaluated?
Before each pass through the loop
When does the initialization expression of a for loop get evaluated?
Once before the loop begins
When does the condition expression of a for loop get evaluated?
Before each loop iteration
When does the final expression of a for loop get evaluated?
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?
Adds 1 to its operand and returns a value
How do you iterate through the keys of an object?
Use a for…in loop
var keys = [ ]; for (var prop in object) { keys.push(prop); }