JavaScript can "display" data in different ways: Writing into an HTML element, using innerHTML. Writing into the HTML output using document.write(). Writing into an alert box, using window.alert(). Writing into the browser console, using console.log().
1
2
3
|
<script>
document.write("Hello World!");
</script>
|
You also can use HTML tags in javascript like.
1
2
3
|
<script>
document.write("<h1>Hello World!</h1><p>Have a nice day!</p>");
</script>
|