Using the while Loop in JavaScript : While : Language Basics JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Language Basics » While »

 

Using the while Loop in JavaScript



<html>
<head>
  <title>Using the while Loop in JavaScript</title>
</head>
<body>
  <script type="text/javascript">
  <!--
    var i = 0;
    var result = 0;
    var status = true;
   
    document.write("0");
    while(status){
      result += ++i;
      document.write(" + " + i);
      if(i == 10){
        status = false;
      }
    }
    document.writeln(" = " + result);
    // -->
  </script>
</body>
</html>


           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Language Basics
» While