JavaScript Loops Worksheet
Questions
Question 1
What is the difference between a while loop and a for loop?
A while loop keeps repeating as long as a condition is true, while a For Loop runs a block of code for a set number of times.
Question 2
What is an iteration?
One complete repeat of a loop.
Question 3
What is the meaning of the current element in a loop?
One that is processed within the body of the loop.
Question 4
What is a 'counter variable'?
A variable that keeps track of how many times something happens.
Question 5
What does the break; statement do when used inside a loop?
Terminate a loop before it completes all of its iterations.
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.