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!

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

What's wrong with my conditional statement?


So I tried following the directions and creating an if-then statement, where an alert box saying "You are correct" would pop up after typing in Javascript for the answer to the prompt question. When I test out my code, it seems to work just fine but for some reason, Treehouse is saying my code is wrong? Not sure where to go from here but any help would be greatly appreciated! ^_^

var answer = prompt('What is the best programming language?');
if (answer === 'Javascript') {
    alert("You are correct")
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="app.js"></script>

1 Answer

Your code is correct, the only issue is you should be looking for "JavaScript" (with a capital 'S') per the instructions. Sorry we're so pedantic sometimes!

Oh, thank you so much! And, no worries-I'm sure the strict syntax makes for good practice in the future! :)