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 trialMaria Cecilia Le Brech
3,611 PointsAdd 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?
<!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>
4 Answers
Jennifer Nordell
Treehouse TeacherMaria Cecilia Le Brech Yes... and no 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!
Leslie Erin Root
13,276 PointsThank 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.
Maria Cecilia Le Brech
3,611 Pointsi did do right stage number 2 var answer=prompt("What is the best programming language?"); if(answer.toUpperCase()==="JAVASCRIPT"){ alert("You are correct"); }
Maria Cecilia Le Brech
3,611 PointsThank you! Ill try that!
Pedro Morales
1,574 PointsThanks, that was hard to find the answer.
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherI'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.