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

Jacob Anderson
Jacob Anderson
7,888 Points

Code challenge keeps telling me that Task 1 is no longer correct while i see if task two is correct.

I don't change anything in task one and I believe that everything is still correct. The challenge just wants me to make a variable "Answer" then open up a prompt asking a question. The second step being adding a conditional statement and I believe everything is correct. I have also went back and done the challenge over again and it passes the first task but never the second task saying that task one is wrong.

app.js
var answer = prompt('What is the best programming language')
if (answer === 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>

1 Answer

james south
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

you don't have quotes around javascript, so it isn't a string. also, while it allowed the code to pass, you don't have a semicolon at the end of the prompt statement, or the ?. generally (this one seems to be a rare exception) challenges are picky and will not pass you if your strings aren't exactly what they are asking for.

Jacob Anderson
Jacob Anderson
7,888 Points

Thanks man. I was getting pretty flustered.