While loop test : While « Language Basics « JavaScript DHTML






While loop test

  
<html>
<script language="JavaScript">
<!--
function loopTest() {
    var index = 1;
    while (index <= 12) {
          if (index == 6)
             break;
          index++;
    }
    document.write("The break statement brings us here.");
}
loopTest();
//-->
</script>
</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.The while Statement
8.Loop in while
9.Check the loop counter for while loop
10.Do ... while loop and output calculation result