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

Gergő Endrész
Gergő Endrész
7,169 Points

This challange simply doesn't work. I can't pass the second task. It says Task1 is no longer passing.

Bug? As I stated in the title, after filling task 2 it says task1 is no longer passing. I don't get it as I didn't change anything on the first line, I just added an if statement which task2 suggests.

app.js
var answer = prompt('What is the best programming language?');
if ( answer.toUpperCase() === "JAVASCRIPT"){

  alert("You are correct");
}
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

Matthew Brock
Matthew Brock
16,791 Points

This worked just fine.

var answer = prompt('What is the best programming language?');
if ( answer === 'JavaScript') {
  alert("You are correct");
}
Georgi Georgiev
Georgi Georgiev
11,122 Points

Hi Gergo,

it seems that you are using .toUpperCase(), which is not part of the challenge's requirements. That is why it does not let you to continue to the next task. Sometimes you must strictly follow the challenge's details and approach it almost the same way as the instructor in the video.

Matthew's example is the solution to passing the step.

Cheers!

Gergő Endrész
Gergő Endrész
7,169 Points

Well that's pretty strange. I only added the .toUpperCase() method after it hadn't accepted my answer (which had been the same as you suggested) stating that the user's answer might have been "javascript" or "JAVASCRIPT". Now it somehow accepted my first solution. Maybe they wanted to teach me how to ask other users in case I get lost.

Steven Parker
Steven Parker
231,271 Points

Are you sure you didn't confuse this with a different challenge? This one seems to be looking for you to match explicitly.

I tried a few things and never could get the response saying you should match against differently cased versions of the word.