Should javascript be put in the head or body?

No. Place all of the JavaScript together in one <script></script> just before the closing body tag. Never spread it out throughout your html. Better still, put it in a separate file and link to that file in script tags that are just before the closing body tag.

2 Likes