how to add javascript to html

HTML
<script src="myScript.js"></script>
<script>
	//JavaScript here
</script><script type="text/javascript" src="yourfile.js"></script><script>

document.getElementById("demo").innerHTML = "My First JavaScript";

</script>
 <script>
	// JS Here  
</script><script src = "index.js"></script>
Source

Also in HTML: