while 循环
- <!DOCTYPE html>
- <html>
- <body>
- <h2>JavaScript while</h2>
- <p id="demo"></p>
- <script>
- var text = "";
- var i = 0;
- while (i < 10) {
- text += "<br>数字是 " + i;
- i++;
- }
- document.getElementById("demo").innerHTML = text;
- </script>
- </body>
- </html>
本文档使用 技术池 构建