You can include JS code within a ‘.html’ page by using an opening and closing script tag. Within the script tags you write the code to be executed. The ‘console.log’ function simply just writes a message to the developer console in the browser. This code will be executed as soon as the page loads.
<script> console.log("Hello World"); </script>