The while Statement : While « Language Basics « JavaScript DHTML






The while Statement

  
<HTML>
<HEAD>
<TITLE>Using the While Statement</TITLE>
</HEAD>
<BODY>
<SCRIPT><!--
i=1
while(i<7){
 document.write("<H"+i+">This is a level "+i+" heading." +"</H"+i+">")
 ++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.While loop
4.Do while loop
5.Using the while Loop in JavaScript
6.The do..while Statement Ensures at Least One Iteration
7.Loop in while
8.While loop test
9.Check the loop counter for while loop
10.Do ... while loop and output calculation result