Check out example codes for "javascript in html". It will help you in understanding the concepts better.

Code Example 1

<script src="script.js"></script>

Code Example 2

<script src="myScript.js"></script>

Code Example 3

<script>
	// JS Here  
</script>

Code Example 4

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

Code Example 5

<script>
	//JavaScript here
</script>

Learn ReactJs, React Native from akashmittal.com