Do ... while loop and output calculation result : While « Language Basics « JavaScript DHTML






Do ... while loop and output calculation result

  

<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
var x = 1
do {
    ++x;
    document.write(x+"<BR>");
}while (x < 10);

</script>
</head>
<body>

</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.Check the loop counter for while loop