JavaScript Loops Worksheet
Questions
Question 1
What is the difference between a while loop and a for loop?
The main difference between a while loop and a for loop is in how and when they evaluate conditions and how they're used.
Question 2
What is an iteration?
Every time a loop runs its code block, that’s one iteration.
Question 3
What is the meaning of the current element in a loop?
The "current element" in a loop refers to the specific item the loop is working on during a single iteration.
Question 4
What is a 'counter variable'?
A counter variable is a variable used to count how many times something happens, usually how many times a loop has run.
Question 5
What does the break; statement do when used inside a loop?
The break statement is used to immediately stop a loop, no matter what the loop's condition is.
Coding Problems
Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.
Always test your work! Check the console log to make sure there are no errors.