The \<script> element is used to define client-side script, such as JavaScript in HTML documents.
* JavaScript in body or head: Scripts can be placed inside the body or the head section of an HTML page or inside both head and body.
* External JavaScript: JavaScript can also be used as external files. JavaScript files have file extension .js . To use an external script put the name of the script file in the src attribute of a script tag. External scripts cannot contain script tags.
Advantages of External JavaScript:
* It separates the HTML and JavaScript code
* It makes JavaScript and HTML easier to read and maintain
* It focuses on code reusability that is one JavaScript Code can run in various HTML files.
* Cached JavaScript files can speed up page loading
```
<!DOCTYPE html>
<html>
<head>
<script>
function f() { }
</script>
</head>
<body>
<script>
function f() { }
</script>
<script src="script.js"></script>
</body>
</html>
```