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

Task 2 is stuck and alerts me that task one becomes invalid when I post the answer.

I just want to confirm that my code is correct, or if not, what it should be.

<!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>
 <script>
   alert('Warning!');
  </script>
</body>
</html>

3 Answers

Stuart Wright
Stuart Wright
41,120 Points

Ah ok, you're right that there's no syntax error, but the reason your code is failing the challenge is because it only wants to see one set of a script tags. You have two sets.

Your first one links to a "scripts.js" file, but this is not necessary for this challenge. You should remove these tags, and your code will pass task two thanks to your second set of script tasks, which carry out the task requested by the challenge.

Thanks so much Stuart! I will make this adjustment now.

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! While Stuart Wright is correct that it generally indicates a syntax error, that is not the case for this particular challenge. This challenge asks you to create one set of <script> tags, but you have two. Your first set is linking to a script.js which likely doesn't exist in this context.

Simply removing the first set of <script> tags causes the challenge to pass.

Hope this helps! :sparkles:

Thank you very much Jennifer! That is very helpful. I obviously wasn't reading closely enough.

Stuart Wright
Stuart Wright
41,120 Points

That error message usually means that you've introduced a syntax error somewhere, meaning none of the code executes, and as a result, your code for task 1 is no longer accepted by the challenge.

But we can't see what code you tried - can you please post it here so we can help?

There we go, I edited it and had to figure out the Markdowns. I am not sure where the Syntax Error would be.