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

Celso Caspe
1,585 PointsStuck on Javascript basics Challenge Task 2 of 3
Javascript basics Challenge Task 2 of 3
I am stuck on this section of javascript basics, I tried my code on the browser console and it seems to be working, but it gives me a bummer error: "Oops! It looks like Task 1 is no longer passing."
I tried to repeat this section several times within the day and with the same error message.
here's my code;
var answer = prompt( 'What is the best programming language?'); if (answer.toUpperCase() == "JAVASCRIPT") { alert("You are correct"); }
what does the error mean? I just signed up for treehouse yesterday. i will appreciate your help.
Thanks.
4 Answers

Jeff Lemay
14,268 PointsThe challenge didn't ask you to use the toUpperCase function inside the if statement. They want you to check if answer is equal to "JavaScript".
This question comes up fairly often. Since the previous video used toUpperCase, users assume the challenge wants you to as well. It is best practice to control the case of a string when checking it, but the challenge didn't ask you to so it's causing a failure.

Shawn Denham
Python Development Techdegree Student 17,802 PointsIt means whatever you did in answering the second task broke the first task. I cannot find the code challenge to try running though it myself :)

Steven Parker
243,095 PointsYou might want to report this as a bug to Treehouse Support, since what you did actually does satisfy the stated requirement.
They asked:
Add a conditional statement that opens an alert dialog box with the message 'You are correct' when the answer is the string 'JavaScript'.
That message "Oops! It looks like Task 1 is no longer passing." is certainly misleading. And your program does, in fact, open an alert box with that message when you give 'JavaScript' as the answer

Jeff Lemay
14,268 PointsIt's not a bug though. The conditional is supposed to check if the string is equal to 'JavaScript'. They don't ask you to convert the string to uppercase and then check if it's equal to 'JAVASCRIPT'.

Steven Parker
243,095 PointsJeff, you're still not considering the instructions literally. They do not say to check if the string is equal to 'JavaScript'. They say to show the message "when you give 'JavaScript' as the answer". They did not say how that determination must be made.
So, for the program that was given, when you give 'JavaScript' as the answer it DOES show the message. So it is literally fulfilling the requirement as stated.
And that error saying "Oops! It looks like Task 1 is no longer passing." is just plain wrong. Setting the variable from the prompt response was unchanged.
So, yes, it IS a bug.

Jeff Lemay
14,268 Points'JavaScript' has to be the supplied answer (case-sensitive). With your route, a user could give 'javascript' or 'JaVaSCRipT' as an answer and the conditional would be true, but those are incorrect answers.
In the real world, you would more than likely want to put the string through a toUpper or toLower function before checking to see if the condition is met. But this is not the real world, this is a code challenge and they state the correct answer is 'JavaScript' with that case-sensitivity.

Francisco Roman Ortiz
Courses Plus Student 2,946 Pointsvar answer = prompt("What is the best programming language?"); if (answer === 'JavaScript') { alert("You are correct"); }
Celso Caspe
1,585 PointsCelso Caspe
1,585 PointsThis solves the problem thanks Jeff, I should have known this is somewhat of a trick question, I was thinking along the same line as Steven since the preceding video teaches that of a scenario that users would input different case letters in filling up the form. I agree with Steven though that the error message is somewhat misleading or is not very helpful. Thanks guys, I appreciate your help. I finished the stage.