It is suggested that you should place the script within the <head> tag or <body> tag. It is good for performance to add JavaScript in <body> element.
Example
Here is an example to add <script> under <body>…</body> −
<html>
<body>
<script>
<!--
document.write("Hello World!")
//-->
</script>
</body>
</html>