If it is perfectly acceptable to put JavaScript right before </body> what is a good reason to keep it in the <head>?
Based on the question JavaScript in <head> or just before </body>?
many answers state that the page will load faster if you put it right before the </body> tag.
However I don’t see any sound arguments on why it should be kept in the <head>. I’m asking because I am not a very strong JavaScript developer and from everything I’ve read and seen, the standard is to keep most JavaScript code and external references in the the <head>.
Anything in the head must be completed before the body is loaded, so it is generally a bad idea to put javascript in there. If you need something while the body is loading, or want to expedite some ajax, then it would be appropriate to put it in the head.