Below is an example of code I have been reading through theJavascript into on http://www.w3schools.com/js/js_whereto.asp and I cannot for the life of me figure out why you woud want to use the document.write command instead of just normal means (<p>TEST</p>)

Can someone enlighten me?



<!DOCTYPE
< html>

<html>
<body>

<h1>My First Web Page</h1>

<p>My First Paragraph.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction()
{
document.write("Oops! The document disappeared!");
}
</script>

</body>
</html>