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

Abz Man
Abz Man
6,702 Points

Have i made an error or is there a problem with the challenge? I find this super easy but for some reason it doesn't wor

dfs

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
<script> alert ("I DID IT!")</script>

2 Answers

brandon downs
brandon downs
11,577 Points

You are really close.. the first task in this challenge is asking you to load the external JS file into you index.html file

This is where you need to use the <script> tags inside the index.html file, nested inside of the <body> tags, you need to link to your external JS file, like this <script src='shout.js'></script>

once the external JS file is linked, you can then just write the alert in the shout.js file

alert('I DID IT!');

you were doing more of an inline JS method, and they were looking for you to link to the external JS file and write your code there

hope this helps!

Abz Man
Abz Man
6,702 Points

Thank you very much!!!!!

Looks like you will want to remove the <script> tags from shout.js.

alert("I DID IT!");