For statement in javascript, JAVA Programming

A for loop repeats until a specified condition evaluates to false. For for loop the JavaScript is similar to the Java and C for loops. A for statement looks as:

for ([initial-expression]; [condition];

[increment-expression])

{Statements

}

While for loop executes, the following sequence of operations take place:

1. The initializing expression initial-expression, if any, is executed. Usually this expression initializes one or more loop counters; however the syntax let an expression of any degree of complexity.

2. The condition expression is evaluated. If the condition is true, the loop statements execute. If the condition is false, the loop terminates.

3. The update expression increment-expression executes.

4. The statements get executed, & control returns to step 2. In fact the syntax provides for single statement; while enclosed in braces '{' and '}', any number of statements are treated like a single statement.