IntroductionWe've started to get familiar with some of JavaScripts control statements. We continue this class by introducing looping.

LoopingVery often when you write code, you want the same block of code to run a number of times. You can use looping statements in your code to do this.

In JavaScript we have the following looping statements:

Essentials of Counter-controlled repetitionCounter-controlled repetition requires:

  1. The name of a control variable (also called the loop counter).
  2. The initial value of the control variable.
  3. The increment (or decrement) by which the control variable is modified each time through the loop (also know as each iteration of the loop).
  4. The condition that tests for the final value of the control variable to determine whether looping should continue.

While

Table of Contents