LINKING to an external javascript file - Include JavaScript Code in HTML - HTML
Learn
HTML - Include JavaScript Code in HTML - Linking to an external javascript file
Linking to an external JavaScript file
<scriptsrc="example.js"></script>
The src attribute works like the href attribute on anchors: you can either specify an absolute or relative URL. The example above links to a file inside the same directory of the HTML document. This is typically added inside the <head> tags at the top of the html document