The <script> Tag
Manipulating HTML Elements
Writing Directly into The Document Output
The example below writes a <p> element directly into the HTML document output:
Use document.write() only to write directly into the document output.
If you execute document.write after the document has finished loading, the entire HTML page will be overwritten: