- Inside the HTML document
<script> document.write(“Hello world”); </script>
- document.getElementById(“demo”).innerHTML = ‘hello”;
The first method is using
HTML DOM and
selector API functions like
The second method, prints the output to the
The third method usually used for creating error or warning for program that is displayed to users as a popup box.
The last method, is
document.write(), that simply write to the document body wiping everything out except the output.