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

Brett Kalwarski
PLUS
Brett Kalwarski
Courses Plus Student 1,733 Points

I am answering the question right but it is saying I am wrong I just want to go forward on now.

It almost looks exactly like the code from the video but different for the question

app.js
var answer = prompt('What is the best programming language?');
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>
Brett Kalwarski
Brett Kalwarski
Courses Plus Student 1,733 Points

It's actually the second part that is not passing every time i put in the right answer

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

or

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

2 Answers

Scott French
Scott French
7,383 Points

Not sure what your doing wrong but these passed for me perhaps case sensitive your answer says (answer == 'Javascript') and you should use a strict equality.

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

if (answer === 'JavaScript'){
  alert("You are correct");
}else {
  alert("JavaScript is the best language!");
}
Steven Parker
Steven Parker
231,275 Points

Your app.js code looks great. :+1:

You should pass task 1 and be able to go on to task 2. If you're not passing task 1, try cutting your answer from above and pasting it directly into the challenge. I did exactly that myself and it passed.