On the for loop

for loop

. 1    < Script > 
2      / * 
3      * (. 1) is performed before the code blocks
 4      Condition ** (2) running code block
 5      block ** (3) to be executed
 6      ** (4) after execution code block execution
 7      ** order of execution (. 1) (2) (. 3) (. 4)
 . 8      * / 
. 9      
10               ( . 1 ) ( 2 ) ( . 4 )
 . 11      for ( var I =  0 ; I <  . 5 ; I ++ ) {
 12 is                   ( . 3 )
 13 is        the console.log ( "Number is "  + I);   
 14      }
 15      the console.log (I);
 16    </ Script >

The results page

Resolution:

When i is equal to 4, then, is less than 5, the implementation of (3) printed: number is 4, then i ++, i is 5 at this time, into the condition (2) is determined, is not less than 5 5. The conditions are not satisfied, terminating the code execution.

When printing out the recycle i, i is 5. In this case it will come to these results.

Guess you like

Origin www.cnblogs.com/PengZhao-Mr/p/10972702.html