Whenever you place a script element on a page, regardless of where it is located, unless you use the defer or async attributes, and the browser that your visitor uses supports them, all HTML parsing ends, and control is passed to the JavaScript interpreter (waiting for the script file to load if the script is in a separate file). This holds back the rendering of your page. Therefore, unless you have a really good reason to place the script tag in a different place, placing the script tag at the very bottom of your page will improve its apparent load time.
Of course, there can be really good reasons. For example, if a script has to use document.write to output HTML to a page (as many ad scripts do), then of course this should be where this HTML code should go. Similarly, if you have a button in the user interface and you attach a handler to this button, which calls your script, if the script is further on the page, there may be a window of opportunity for the user to click the button before your script processes the click. Doing nothing or not getting an error that adversely affects the user's work.
If your page is fully functional without any script (good practice for most general purpose sites), with the script just increasing your experience, put the script at the bottom. If the script is critical to the functionality of your site (a perfectly acceptable practice for some sites and, of course, for many web applications), it is best for your build process to combine all of your custom JavaScript into one file, reduce it, and link it in head so that you get the job done as short as possible. (If your script relies on libraries, you can download them separately from the CDN for speed, or add them to your custom code, depending on your rating, which will be faster for your users.)
This is all speed / perceived speed argument. From the point of view of separation of attention, make sure that all your JavaScript is in separate files (at least in separate source files, you can create a build process that combines your JavaScript into your HTML to create an output file for the user without breaking the separation problems, but then you cannot get your JavaScript caching if you use it on multiple pages). If you have a separate JavaScript file, you will have to link to the script somewhere, I donβt think it really matters a lot to split points of view, where as long as you don't have script elements littered throughout the HTML source .
Edit : see also David Murdoch's answer , specifying Google by the value of the built-in script blocks for connecting the user interface. I wanted to refer to him, but could not find him; he did. This is a pain because (if you do not do it with a build script), it really confuses the separation of problems. Above, it shouldn't be that hard to do with tags and build a script ...