While & For Loop In javascript For javascript Beginners

Sabarimahesh
Posted by Sabarimahesh under JavaScript category on | Points: 40 | Views : 968
JavaScript While Loop

<script type="text/javascript">
var count= 0;
var break= "<br/>";
document.write("While Starting");
document.write(break);
while(count< 100)
{
document.write("count= " + count);
document.write(break);
count++;
}
document.write("While Ending");
</script>


JavaScript For Loop

<script type="text/javascript">
var break= "<br />";
document.write("Forloop Starting ");
document.write(break);

for(i = 0; i < 5; i++){
document.write("Count i = " + i);
document.write(break);
}

document.write("Forloop Ending");
</script>

Comments or Responses

Login to post response