What is document.write in JavaScript?

document.write replaces whole page HTML with new HTML, that you give it.

For example, calling this:

document.write('<strong style="color: red">Hello World!</strong>');
Replaces the whole page with a bold, red Hello World! phrase in the top left corner.