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

JavaScript Conditional Statements Code Challenge

I'm having trouble with this code challenge.

My code for Task 1 works fine but when I get to Task to and have to input my conditional statement I get an error of "Oops! It looks like Task 1 is no longer passing".

I've retried it a heap of times and keep getting the same error. I really don't know where I am going wrong as I haven't changed anything on the code from Task 1.

Any help would be greatly appreciated :-)

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>

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Don,

You currently have too much code for what task 2 is asking for, what it wants is for you to check the value of answer and see if the value matches JavaScript without any kind of transforming or manipulation. Your code was close, just needs a couple of minor changes which you can see below.

if (answer === "JavaScript") {
  alert("You are correct");
}

Happy coding!

D'oh!!! Trying to be too clever and not reading the question fully :-)

Thanks for the help :-)