While Loop
Syntax:
while(condition)
{
// statements that will be executed
}
Example
<script type="text/javascript">
var i=0;
while (i<=4)
{
document.write("The value of i is :"+i+ "<br />");
i++;
}
</script>
Output
You can write the following code and result will be same.
{
document.write("The number is " +i);
document.write("<br />")
i++;
}
No comments:
Post a Comment