JavaScript Loops Worksheet
Questions
Question 1
What is the difference between a while loop and a for loop?
A 'for loop' is different from a 'while loop' in that they contain a counter variable
which is used to decide how many times the loop runs.
Question 2
What is an iteration?
An iteration is the used to describe every time the code in the 'loop' body
is executed/run.
Question 3
What is the meaning of the current element in a loop?
When you loop through an array, a current element is the element that is processed within in the
of the loop. The focus of the body will change after each iteration, if that is how the loop is set,
and the current element is that focus.
Question 4
What is a 'counter variable'?
A counter variable is the part of the 'for loop' that sets the amount of times a loop iterates.
Question 5
What does the break; statement do when used inside a loop?
A break; statement ends the loop before it completes all the 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.