Let us take a simple example to print out “Hello World”.
First open Notepad, and type the following code in it and save it as .html extension.
Then open the web browser and load the file from browser’s menu and check the result.
Result out: Hello World
There is one statement document.write() that is used to print the output. Here write() is a method of the document object.