In order to link your js file to html, you need to use the script tag. The script tag goes in the head of your html document. Here is an example: <script src="script.js"></script>
This line of code links the js file “script.js” to the html document.
HTML script src Attribute
The src attribute is used to specify the source of an HTML script.
What is JS file