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

stephenallison
stephenallison
8,559 Points

Stuck on Challenge in Javascript

Not sure what I'm doing wrong to receive an error. But the way I currently have my code, makes the code from challenge 1 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>

  <script> alert("I DID IT"!); </script>
</body>
</html>
shout.js

2 Answers

Jorge Valerio
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jorge Valerio
Front End Web Development Techdegree Graduate 24,696 Points

delete <script> alert("I DID IT"!); </script> from you index.html file and then and then click on your shout.js file and write ---> alert("I DID IT"!);

andren
andren
28,558 Points

You might want to thoroughly read over the challenge text one more time:

Inside the shout.js file, write the code for an alert dialog with the message 'I DID IT!'

Your alert code is fine, but you have embedded it in the HTML file which is not what the challenge is asking you to do. There are two files in the workspace, index.html and shout.js. The reason why you were asked to link to the shout.js file in the first task is so that you can place your JavaScript code in that file.

BRILLIANT ANSWER ANDREN