link js file to index.html
snippet in javascript

how to link js to html

user1445

<script src="Your-JavaScript-File.js"></script> <!--If JS file is in same folder with HTML file-->

link js file to index.html

user5810

 <script src="your js file"></script>

how to enter javascript in html

user3208

<script type="text/javascript">
  alert("This alert box was called with the onload event");
</script>

How to add js file to a site through url

user9806

var jsFile = document.createElement("script");
jsFile.src = "homePage.js";  // it can be path also  "{themes('/scripts/homePage.js')}"
document.body.appendChild(jsFile);  //append it as src to body