Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Introducing JavaScript Link to an External Script

Megan Yoon
PLUS
Megan Yoon
Courses Plus Student 329 Points

I've added the 'src' but it's telling me that I haven't.

I don't understand what I'm doing wrong.

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

4 Answers

Steven Parker
Steven Parker
231,271 Points

The attribute and value need to go inside the start tag:

  <script src="shout.js"></script>

You're SO close! This is kind of confusing. You actually have to include your src inside of the first script arrow-brackets, like this:

<script src="shout.js"> </script>

Hope that helps! Happy coding!

Ha! You must have submitted your answer while I was typing out mine. Because this had no answers when I clicked on it. Funny! Let's just hope we're both right, otherwise that would be awkward ;)

Steven Parker
Steven Parker
231,271 Points

That happens to me all the time, particularly if I get distracted for while when composing an answer. :wink:

Treehouse community = much nicer than Stack Overflow folks.

Steven Parker
Steven Parker
231,271 Points

That's nice to hear. One possible factor in our favor is everyone is here for learning .. over there they might often be dealing with issues under pressure for business.

Megan Yoon
PLUS
Megan Yoon
Courses Plus Student 329 Points

You two have been so much help! That was the correct answer. Thank you so much!!! :)