[英]Indentation issue
I would like to know if my indentation for this file is correct or not because my result that I got is not aline together (not straight).我想知道我对该文件的缩进是否正确,因为我得到的结果不一致(不直)。
<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>
Result:结果:
You need to remove the text between the <pre>
and the <script>
:您需要删除
<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>
Or, even better, avoid document.write
entirely:或者,更好的是,完全避免
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.