While loop : While « Language Basics « JavaScript DHTML






While loop

  
<html>
<body>

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

</body>
</html>



           
         
    
  








Related examples in the same category

1. A While Loop That Decrements from 10 to 1
2.Using a Do/While Loop to Reverse a Text String
3.Do while loop
4.Using the while Loop in JavaScript
5.The do..while Statement Ensures at Least One Iteration
6.The while Statement
7.Loop in while
8.While loop test
9.Check the loop counter for while loop
10.Do ... while loop and output calculation result