For Looping In Java Script

This loop contains the initial value, termination value , increment/decrement value in a single line, which in on other looping are used in separate line, the scope of a for loop is inside the curly bracketsused with it. The initialization segment is executed only once at the start of the loop and terminationand increment/decrement segments are executed every time till the condition remains true.
for(initialization; termination; increment/decrement)


code to be executed






<script type=”text/javascript”>

var a;



document.write(” “+a)





Understanding program :
Value of a is initially 100 , the condition with for loop is while a is greater 0 the statements typed should be executed. a-=5 means a=a-5, so the a will get decremented with 5 every time. As soon as a becomes 0 the loop gets terminated.
100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5