document.write()The document.write() function allowes you to write anything onto a page.
So, if I want to say Hello World, I would use this:
<script type="type/javascript">
document.write("Hello World");
</script>
You can also use HTML with it too.
Another thing you can do is call other functions or variables through a document.write() function. here is an example of a variable being used:
<script type="type/javascript">
var text = "Hello World";
document.write(text);
</script>
You may also use HTML there.
alert()The alert() function alowes you to create a pop-up. So, if you wanted to create a pop-up with the text Hello World, you would do this:
<script type="type/javascript">
alert("Hello World");
</script>
You may use HTML with it. Just like the document.write() function, you can use a variable.
<script type="type/javascript">
var text = "Hello World"
alert(text);
</script>
That would make do the same thing as the alert("Hello World").