JavaScript Loops Worksheet
Questions
Question 1
What is the difference between a while loop and a for loop?
A for loop contains a counter variable while a while loop does not
Question 2
What is an iteration?
Each time the code of a loop loops is an iteration
Question 3
What is the meaning of the current element in a loop?
The current element is the element of the array that is currently active in the loop.
Question 4
What is a 'counter variable'?
It is a variable that is initiated and then counts in some way shape or form to be evaulated in a for loop.
Question 5
What does the break; statement do when used inside a loop?
It will end the loop if it satifies the conditions you want it to before going through all of 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.