[英]Indentation issue
您需要删除<pre>
和<script>
之间的文本:
<html> <head> <title>Javascript for Loop</title> </head> <body> <pre><script type = "text/javascript" > let x = 5; do { document.write("do while Looping " + x + "\n"); x++; } while (x < 10) </script> </pre> </body> </html>
或者,更好的是,完全避免document.write
:
let text = ''; let x = 5; do { text += "do while Looping " + x + "\n"; x++; } while (x < 10) document.querySelector('pre').textContent = text;
<pre></pre>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.