JavaScript Loops Worksheet
Questions
Question 1
What is the difference between a while loop and a for loop?
For loops include a counter variable that allows us to control how many times the loop iterates.
Question 2
What is an iteration?
An iteration refers to each time the block of code executes in the loop body.
Question 3
What is the meaning of the current element in a loop?
The current element refers to the specific value in an array determined by its index positon when looping.
Question 4
What is a 'counter variable'?
The counter variable is used in "for" loops as a way to represent how many iterations the loop will perform based on the other conditions of the loop.
Question 5
What does the break; statement do when used inside a loop?
The break statement terminates a loop early once a condition is met.
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.