In JavaScript, writeln means "newline output", which is used to write HTML expressions or JavaScript code to the document, and write a newline character after each expression, the syntax is "document.writeln (exp1,exp2,exp3,....)".
The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.
What is the meaning of writeln in javascript
The write() method can write HTML expressions or JavaScript code to the document.
Multiple parameters (exp1, exp2, exp3,...) can be listed, and they will be appended to the document in order.
The writeln() method has the same effect as the write() method, except that a newline character can be written after each expression.
The syntax is as follows:
document.writeln(exp1,exp2,exp3,...)
exp1 represents the output stream to be written. They will be appended to the document in order.
The example is as follows:
<html> <head> <meta charset="utf-8"> <title>123</title> </head> <body> <p>注意write()方法不会在每个语句后面新增一行:</p> <pre class="brush:php;toolbar:false"> <script> document.write("Hello World!"); document.write("Have a nice day!"); </script>
注意writeln()方法在每个语句后面新增一行:
<script> document.writeln("Hello World!"); document.writeln("Have a nice day!"); </script>