Thursday, April 14, 2011

How to use do while Loop in Java Script: Display 2’s Table:


Do while loop check the conditoin at the end of the loop so even the condition is true of false it must complile the loop code at least once. 

<script language="javascript">
var j=2;
i=1;
do
{
tab=i*j;
document.write(i+"*"+j+"="+tab+"<br/>");
i++;
}while(i<=10);
</script>

No comments:

Post a Comment