Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

HTML | DOM writeln() Method

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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

Syntax:

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

Parameters: This method contain many parameters which is optional. All the expression arguments (exp1, exp2, …) can be listed and display with the order of occurrence. 

Example: 

html




<!DOCTYPE html>
<html>
    <head>
        <title>DOM writeln() Method</title>
        <style>
            h1 {
                color:green;
            }
            body {
                text-align:center;
            }
        </style>
    </head>
    <body>
        <h1>GeeksforGeeks</h1>
        <h2>DOM writeln() Method</h2>
        <pre>
        <script>
            document.write("Hello World!");
            document.write("Have a nice day!");
        </script>
        </pre>
        <pre>
        <script>
            document.writeln("Hello World!");
            document.writeln("Have a nice day!");
        </script>
        </pre>
    </body>
</html>

Output:

  

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

  • Chrome 64
  • Edge 12
  • Internet Explorer 4
  • Firefox 1
  • Opera 51
  • Safari 11

My Personal Notes arrow_drop_up
Last Updated : 13 Jul, 2022
Like Article
Save Article
Similar Reads
Related Tutorials