Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>The Document Object</h1> <h2>The write() and writeln() Methods</h2> <p>write() does NOT add a new line (CR) after each statement.</p> <p>writeln() DOES add a new line (CR) after each statement.</p> <pre> <script> document.write("Hello World!"); document.write("Have a nice day!"); document.write("<br>"); document.writeln("Hello World!"); document.writeln("Have a nice day!"); </script> </pre> <p>It makes no sense to use writeln() in HTML.</p> <p>Carriage return (CR) is ignored in HTML.</p> </body> </html>