Javascript can be included in HTML by whether embedding it to the HTML file itself, or by calling an external file.

There are few options to include Javascript code into HTML, but the current best practice is as in the example below;

<script type="text/javascript">     window.alert("Hello World") </script>

The above example using type and MIME type, when called from anywhere in the HTML page, will pop up an alert with the Hello World text.