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) Making Decisions with Conditional Statements Introducing Conditional Statements

Add a conditional statement that opens an alert dialog box with the message "You are correct" when the answer is the str

When i try to do task 2 there appears a message saying "Task one is no longer passing" Can you fix this so i can earn my badge?

app.js

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="app.js"></script>
</body>
</html>
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

I'd prefer to see your code so that I can help explain what's going wrong. There's a markdown cheatsheet at the bottom of this page that will show you how to post code to us so that we can help you debug it. :smiley:

4 Answers

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

Maria Cecilia Le Brech Yes... and no :smiley: Challenges are very picky and you went above and beyond the call of duty here. You're checking the answer regardless of what capitalization the user enters, which is a great thing! But it doesn't match with the instructions of the challenge. They explicitly ask you to compare to the string "JavaScript". If you don't compare against that string, the challenge fails. Take a look:

var answer=prompt("What is the best programming language?");
if(answer ==="JavaScript") { 
  alert("You are correct"); 
}

Happy coding! :thumbsup:

Thank you for your explanation, I was doing the same thing and could not understand what was wrong. Everyone thinks they are detail oriented until they take a JavaScript class and learn what detail oriented really means.

i did do right stage number 2 var answer=prompt("What is the best programming language?"); if(answer.toUpperCase()==="JAVASCRIPT"){ alert("You are correct"); }

Thank you! Ill try that!

Thanks, that was hard to find the answer.