link your javascript into your html code example
Example 1: linking a script .js
<script type="text/javascript" src="path-to-javascript-file.js"></script>
Example 2: how to link javascript to html
<script src = "index.js"></script>
<script type="text/javascript" src="path-to-javascript-file.js"></script>
<script src = "index.js"></script>