This is used to display a given text in a web page.
This is mainly used for testing purpose.
Example 1 - Write string
Example 2 - Write html content
When document.write() is executed after the page load, it will erase all the contents in the web page and shows only the text specified in it.