Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,258 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.