The <script> tag

  • The <script> tag lets you put JavaScript on your HTML page
  • Lets you either write JavaScript right in HTML or in another file
  • Variables and functions become global on the page
<html>
    <body>
        <h1>My page</h1>
        <script>
            const a = 1;
            console.log(a + 2);
        </script>
    </body>
</html>

21 / 24