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

JavaScript basic

on challenge question 2 here is my code and it is not passing. I have checked with the answers you guys have posted and it appears to be the same. It is not passing. I have had alot of difficulties with my answers passing. they will eventually pass after time. I have changed to chrome thinking that would help. I do have the right answers and it says no. please help.

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



   </body>
 </html>

I keep getting a warning that states the page at treehouse challenge has: WARNING! That's it

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi Cathy,

There are a few things with your code that would cause it to fail.

You're outputtng the correct string as you say but when you're referencing the file you're missing a quotation mark in the html.

So

<script src= "scripts.js"></script>
<script>
  alert("Warning!");
</script>

Would work.

But...

The challenge doesnt' require you to link to a scripts.js file.

You could pass the challenge by having an empty script tags, and putting your code directly inside it.

<script>
  alert("Warning!");
</script>

In real-world situations though what you did was correct. You would typically link to an external javascript file and then put your code inside that.

Johnathan, I tried that code above and that doesent work. The message I have been getting is: you didn't call the alert()' function inside the <script tag. that is with the code above. I tried that several times before asking for help. Anymore advice? And to make it clear that is with just:

<script> alert("Warning!"); </script>

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

That sounds odd. The code in the last code block I gave you should work.

The code challenge is in 2 parts so you'd make sure the code you put in is only the code that each part of the challenge wants.

Make sure it's in between the body tag in the code challenge. Write your script tags and then the alert function.

Good luck. :)