JavaScript code is written directly into
the HTML page inside the script
tag.
This tag can be placed anywhere on the page.
Let’s see an example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>This is the title</title>
<script>
we write JavaScript code here
</script>
</head>
<body>
This is the main content of the page.
</body>
</html>