Open In App
Related Articles

HTML DOM writeln() Method

Improve Article
Save Article
Like Article

The writeln() method is used to write a document with the additional property of a newline character after each statement. This method is similar to the document.write() method. 


document.writeln( exp1, exp2, exp3, ... )

Parameters: This method contains many parameters which are optional. All the expression arguments (exp1, exp2, …) can be listed and displayed in the order of occurrence. 

Example: In this example, we will use the writeln() method


<!DOCTYPE html>
    <title>DOM writeln() Method</title>
        h1 {
            color: green;
    <h2>DOM writeln() Method</h2>
            document.write("Hello World!");
            document.write("Have a nice day!");
            document.writeln("Hello World!");
            document.writeln("Have a nice day!");


 Supported Browsers: The browser supported by writeln() method are listed below:

  • Chrome 64
  • Edge 12
  • Firefox 1
  • Opera 51
  • Safari 11
Last Updated : 03 Aug, 2023
Like Article
Save Article
Similar Reads
Related Tutorials