I usually have the Javascript or Jquery of my web apps in external files that I link to from index.html. Using:
<script src="../js/somple.js"></script>
I have notice most applications link to js the same way but it seems to be a common practice to also have some of the JavaScript in the same index page. (either on header section or at the bottom of the page)
Such as:
<script type="text/javascript">
......
</script>
My question:
In what cases could I benefit from keeping the JavaScript in the same file?
I understand having the Javascript at the bottom of the page as opposed to having it enclosed on header allows html contend to load first, but what about placing the JS externally? I just want to learn about good practices and load speed/efficiency regarding the location of JS.