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

Brian Platt
Brian Platt
5,009 Points

Task 1 is no longer passing

Hey! I can't for the life of me see what my problem is with this assignment. I passed number one and then failed on number two because the first step is no longer passing, any thoughts?

Here is my code var answer = prompt('What is the best programming language?'); if ( answer.toUpperCase() === 'JAVASCRIPT' ) { document.write("<p>You are correct</p>"); }

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>

3 Answers

David Kaneshiro Jr.
David Kaneshiro Jr.
29,247 Points

I went through the exercise and I found that the reason why you are getting "Task 1 is no longer passing" is because the exercise wants your code to check for the exact string of 'JavaScript' without converting to all upper case. Also the exercise wants you to display the string "You are correct" to an alert box instead of writing it to the document.

Steven Parker
Steven Parker
231,007 Points

David is correct, but your conditional literally satisfies the challenge requirement. It does give the response if the answer given is "JavaScript". The trick is that it ALSO gives that response for other answers (different case combinations). But the challenge didn't specifically say "only if the answer is the string 'JavaScript'".

You might want to report this as a bug to Treehouse Support. You may even get an "Exterminator" badge!

If you made a mistake, hit the reset code button. The responses above answer the problems of not following the challenge questions as stated.

var answer = prompt('What is the best programming language?');
if (answer === 'JavaScript'){
    alert("You are correct");
}
Brian Platt
Brian Platt
5,009 Points

Thanks guys! I'm new to this but it's good to get a sense of how rigid JavaScript can be right off the bat so I am not surprised later. I sent in a bug request as well!