Check the loop counter for while loop : While « Language Basics « JavaScript DHTML






Check the loop counter for while loop

 
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">

var i = 1;
while (i < 101) {
    if (i == 99) {
        alert("The number is " + 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.The while Statement
8.Loop in while
9.While loop test
10.Do ... while loop and output calculation result