Learned
- The "script" tag
- External scripts
The "script" tag
- JS programs can be inserted almost anywhere into an HTML document using the
<body>
<script>
alert('Hello, world!');
</script>
</body>
External scripts
- We can put it into a separa file if we have a lot of JS code
- Script files are attached to HTML with the src attribute
<script src="/path/to/script.js"></script>
Summary
- We can use a script tag to add JavaScript code to a page
- The type and language attributes are not required.
- A script in an external file can be inserted with <script src="path/to/script.js" /script>.
Tasks
Q. Show an alert

Q. Show an alert with an external script
