JavaScript For loop

Submitted by:Tim Kelly

Date added:28 January, 2012

Category:JavaScript

This loop will starts with 0 and will continue As long as i less than, or equal to 5

Tags: for loop

Code Snippet:

<html>
<body>

<script type="text/javascript">
var i=0;
for (i=0;i<=5;i++)
{
document.write("The number is " + i);
document.write("<br />");
}
</script>

<p>Example:</p>

This loop will starts with 0 and will continue As long as i less than, or equal to 5

</body>
</html>

 
 

Comments