writeln() method works just like the
document.write() method to make it easier to read.
However, it can be use to create new lines in display elements such as alert boxes, prompts, etc.
document.write("Hello world! \n Is everything okay?");
document.writeln() method adds a new line character at the end of the statement we could rewrite the code as follow:
document.writeln("Hello world!"); document.writeln("Is everything okay?");
Although the code is on two lines, the appearance in the browser is the same.