1. Home
  2. Computing & Technology
  3. JavaScript

For

By , About.com Guide

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

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  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.