First we need nodejs to be installed so that we can run our js code in the code editor: https://nodejs.org/en

The “script” tag

JavaScript programs can be inserted almost anywhere into an HTML document using the <script> tag.

<!DOCTYPE HTML>
<html>
<body>
  <p>Before the script...</p>
  <script>
    alert( 'Hello, world!' );
  </script>
  <p>...After the script.</p>
</body>
</html>

External scripts

If we have a lot of JavaScript code, we can put it into a separate file.

Script files are attached to HTML with the src attribute:

<script src="/path/to/script.js"></script>

Tasks: