While loop :
while (var<=endvalue)
{
code to be executed
}
<html>
<body>
<script type=”text/javascript”>
var i=0;
do
{
document.write(“the number is”+i);
document.write(“<br/>“);
i++;
}
while (i<=5);
</script>
</body>
</html>
Output :
The number is 0
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5