Title:
JavaScript Loops Worksheet
Updated:
November 16, 2023
Task/Activity:
  1. Questions
  2. Coding Problems
A. Questions
  1. What is the difference between a while loop and a for loop?
A for loop and a while loop only really differ in where you have the code that makes the condition false. While loops need it inside the body. For loops typically have it with the condition.
  1. What is an iteration?
A single time that the code inside a loop is performed. One loop.
  1. What is the meaning of the current element in a loop?
The current element is, when the loop is interacting with an array, the element of that array that the loop is currently working with.
  1. What is a 'counter variable'?
The variable inside of a for loop that changes with each iteration.
  1. What does the break; statement do when used inside a loop?
Ends the loop.
B. Coding Problems
Coding Problems - See the 'script' tag below. 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.