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

Platform error "Task one is not passing"

Even though my answer registered as correct, the platform won't allow Task 2 to be completed. (I've tried on a PC, Mac; on Safari, Firefox, and Chrome.) Update: I tried again and received this message: "Oh no! There was a communication problem. If you continue experiencing problems, please contact support at help@teamtreehouse.com."

The Treehouse team recommended that I try in Chrome Incognito (or Firefox Pvt. browsing), (and that maybe an extension was causing the problem), but I just tried it in Incognito and the same thing happens: (I get an "correct" indicator after answer one, then after answer 2 I get "Oops Task One is not passing."

Can you share the code you tried?

The code registers as correct:

var answer = prompt('What is the best programming language?');

And what about the code you tried for task 2?

var answer = prompt('What is the best programming language?');
if (answer.toUpperCase() === 'JAVASCRIPT') {
  alert('You are correct');
}

(Works in exercise code previewer)

2 Answers

Well, I found your problem, although it is specifically with this challenge and not with your code. When a challenge asks you to do something, it is very specific about what it wants so you shouldn't add in extra methods. This is exactly what the challenge wants:

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

Now, with that being said, your method is superior to this method because it takes into account differences of capitalization, although the challenge is more meant to test your knowledge of how to use comparison operators.

Thanks very much Marcus. I didn't realize that correct code can stop the platform from working. (I guess it's set up to check things in a very literal way.) But it's also odd because the example of .toUpperCase was used in the video preceding the exercise. I think I'll drop them a line suggesting a change in Task 2 so that it will take either solution. Meanwhile, I'm happy to have scored a few more points and to be moving ahead in the track. :^)

It is very literal in what it wants. The thing is that it is drastically harder to check for modular code than it is to check for static code (especially in later, more advanced JavaScript exercises). In this one, it would be fairly easy because there are really only a few cases that would be perfectly valid and accomplish the task at hand, even in a better manner such as you have. Trying to find all the cases of how to accomplish one thing can prove to be very tricky, which is why they are very specific in the problem text and very specific about what they accept for an answer.

Oh, and I forgot to say, you're very welcome, Sherrie, and Happy Easter and Coding! :)