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

Ram Iyer
Ram Iyer
9,116 Points

I am getting this error where it is telling me use answer==='Javascript' when that is exactly what I have done

My code var answer = prompt("What is the best programming language?");

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

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>

3 Answers

Take a closer look at the capitalization you have and what they ask. When comparing 2 strings, the condition will be false if you do not have the same capitalization on both strings. In later course you will learn how to deal with this.

Ram Iyer
Ram Iyer
9,116 Points

Add a conditional statement that opens an alert dialog box with the message "You are correct" when the answer contains the string 'JavaScript'

That is what they asked and what I have put in my code. Its Javascript with a capital J.

I am also getting the desired output.

Ram Iyer
Ram Iyer
9,116 Points

Oh I am sorry, I see it now. Thanks a lot!