Intro to JavaScript | Variables | Operators | Functions | If/else | For loops | Events

For loops

For loops are used to perform an actions lots of times.
With a for loop you can define how many times a given script should run.

Syntax
for (define var; condition; increment/decrement var) {
// do something
}

Example
var i; for (i=1;i<=10;i++) {
document.write("This is line " + i + "
");
}