JavaScript

  1. Home
  2. Computing & Technology
  3. JavaScript

For

By Stephen Chapman, About.com

Definition: The for statement specifies a block of code that is to be run multiple times. The for statement contains three sub-statements that control the loop processing. The first statement is run once at the start and usually defines a loop counter. The second statement is the condition statement tested after each time through the loop. The third statement runs at the end of each time through the loop and is usually used to increment the loop counter. For is a reserved word and cannot be used for anything other than declaring a for loop.
Examples: for (var i = 0; i < 10; i++) {...}

Explore JavaScript

About.com Special Features

JavaScript

  1. Home
  2. Computing & Technology
  3. JavaScript
  4. Reference
  5. Javascript Glossary - For

©2009 About.com, a part of The New York Times Company.

All rights reserved.