while循环的目的是在表达式为真时重复执行语句或代码块。一旦表达式变为假,则循环终止。
您可以尝试运行以下代码来学习如何使用嵌套的while循环
<html>
   <body>
      <script>
         var height = 2;
         var width = 8;
         var col = 0;
         var row = 0;
         document.write("Starting Loop<br> ");
         while (row < height) {
            col = 0;
            while(col < width) {
               document.write("#");
               col++;
            }
            document.write("<br>");
            row++;
         }
         document.write("循环停止!");
      </script>
   </body>
</html>