HTML DOM writeln() method
Document Object
Definition and Usage
The writeln() method works the same as the write() method, plus it writes a newline character after each expression.
Syntax
document.writeln(
exp1,exp2,exp3,...
)
| Parameters | Description |
|---|---|
| exp1,exp2,exp3,... | Optional. The output stream to write to. They will be appended to the document in order. |
Browser support





All major browsers support the writeln() method
Example
Example
The difference between write() and writeln():
Note that write() does NOT add a new line after each statement:
Note that writeln() add a new line after each statement:
Try it »
Document Object