Use the
for a newline character.
document.write("
");
You can also have more than one:
document.write("
"); // 3 new lines! My oh my!
However, if this is rendering to HTML, you will want to use the HTML tag for a newline:
document.write("<br>");
The string Hello
Test
in your source will look like this:
Hello!
Test
The string Hello<br><br>Test
will look like this in HTML source:
Hello<br><br>Test
The HTML one will render as line breaks for the person viewing the page, the
just drops the text to the next line in the source (if it's on an HTML page).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…