Javascript For Loops Flashcards
1
Q
When is the first expression in the parentheses for a for loop (known as the initialization) evaluated?
A
It’s evaluated once before the loop begins.
2
Q
When is the second expression in the parentheses for a for loop (known as the condition) evaluated?
A
It’s evaluated before each loop iteration.
3
Q
What is the purpose of the condition in a for loop?
A
Defines the condition for executing the code block.
4
Q
When is the third expression in the parentheses for a for loop (known as the final expression) evaluated?
A
It’s evaluated at the end of each loop iteration.
5
Q
What is the purpose of the final expression in a for loop?
A
Generally used to update or increment the counter variable.