When one should use the javascript in head section in html. And if I print my name in the head section using javascript something like this :-
<!DOCTYPE html>
<html>
<head>
<script>
document.write('akshat');
</script>
</head>
<body>
<h2>Demo JavaScript in Head</h2>
</body>
</html>
then where it is going to print my name which I print with the help of javascript code? before body elements or after?