JavaScript JavaScript Basics Introducing JavaScript Link to an External Script

Indigo Mudbhary
Indigo Mudbhary
565 Points

How come the message is not in the shout.js file? <script src = shout.js> alert("I DID IT!"); </script>

The course is saying that the message is not a part of the shout.js file. Why is it staying that? Thanks.

index.html
<!DOCTYPE HTML>
<html src = index.js>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
  <script src = shout.js>
    alert("I DID IT!");  
  </script>  
</body>
</html>
shout.js

1 Answer

Steven Parker
Steven Parker
150,087 Points

You've put your code in "index.html" between the script tags. But tags that load in a file should not have any code content between them.

To enter your script code, first click on the "shout.js" tab to switch files and then put the code there.

Indigo Mudbhary
Indigo Mudbhary
565 Points

Thank you Steven Parker!! Now I got it.