Calculate

Example for For Loop

Click the button to loop through a block of code five times.

Try it

function Function() { var text = “”; var i; for (i = 1; i < 6; i++) { text += "The number is " +i+ "
“; } document.getElementById(“Sample”) .innerHTML = text; }