How to Include a JavaScript File

To include a JavaScript file on a webpage, insert a <script> tag:

<!DOCTYPE html>
  <title>My Page</title>
  <script src="test.js"></script>
  Hi, here is some text.

where test.js file is a text file with some JavaScript in it, e.g.:

alert('hi there');

Next: Conditional 'if' statements in JavaScript


Leave a comment

What color are brown eyes? (spam prevention)
Code under MIT License unless otherwise indicated.
© 2020, Downranked, LLC.