Mega Code Archive

 
Categories / JavaScript Tutorial / Statement
 

Using the JavaScript for Loop

< HTML> <HEAD> <TITLE> Using the JavaScript for Loop </TITLE> </HEAD> <BODY> <H1>Using the JavaScript for Loop</H1> <SCRIPT LANGUAGE="JavaScript"> <!-- var i, total total = 0 for (i = 1; i < 5; i++) {    total += i    document.write("Loop iteration " + i + " (Cumulative total = "  + total + ")<BR>") } // --> </SCRIPT> </BODY> </HTML>