javascript-loops Flashcards
What is the purpose of a loop?
to make a repetitive process quicker and easier
What is the purpose of a condition expression in a loop?
it dictates when the loop will be exited. “when should i stop”
What does “iteration” mean in the context of loops?
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.
When does the condition expression of a while loop get evaluated?
before code block runs on each iteration
When does the initialization expression of a for loop get evaluated?
it is the first stop upon entering the for loop
When does the final expression of a for loop get evaluated?
after the code block and before the condition is checked
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 adds one to the value of the variable next to it
How do you iterate through the keys of an object?
for in loops