JavaScript in Head element
HTML
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Function is called";
}
</script>
</head>
<body>
<h2>Is There Any Special Place to script Tag</h2>
<h2>JavaScript in Head element</h2>
<p id="demo">This is paragraph</p>
<button type="button" onclick="myFunction()">Click Me</button>
</body>
</html>