JavaScript code is typically placed inside the <script> element in HTML. You can add the <script> element directly within the <head> or <body> section of your HTML document. Here is an example:
<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
<script>
// JavaScript code can go here
console.log("Hello, JavaScript!");
</script>
</head>
<body>
<!-- Content of the web page -->
</body>
</html>
html复制成功复制代码
You can also include external JavaScript files using the <script> element with the src attribute pointing to the external file location.