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 Write Another Program

Glitch in test.

After speaking with a developer at my place of employment, he determined that I am doing this correctly. Please let me know what I can do from here. I would like to move on to the next challenges.

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

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Jennifer, There are a couple things wrong with your code: First, the first challenge question just asks for you to add 2 script tags in-between the opening and closing body tags (not in the head tags).

<body>
<script></script>
</body>

Add the alert code in-between the script tags: Complete code:

<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
  <script>
    alert("Warning!")
  </script>
</body>
</html>

There is no need to be adding a test.js script src file, because you are not linking anything to a file. Here it is all being done inline.

The challenges are very picky... Lol.

Hope that clears it up. Jason :)

Thank you, thank you, thank you!

I WISH I COULD HUG YOU!

Based upon the lesson, I suppose I misinterpreted what was being asked of me initially. Differences between the two are noted!

The code challenge is being pedantic and would prefer that you show the alert in a script element within the body.

<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
  <script>
    alert("Warning!");
  </script>
</body>
</html>