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

Michael Gardiner
Michael Gardiner
4,282 Points

Don't see the problem

Where did I trip up?

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>
Laura Kyle
Laura Kyle
19,794 Points

Hey there! I'm pretty sure it's just that the "S" in JavaScript needs to be capitalized. Give that a shot.

Laura Kyle
Laura Kyle
19,794 Points

If it makes you feel any better, these types of mistakes are guaranteed to plague your entire career as a developer. You just get better at debugging them, but they will forever remain frustrating. ...That probably didn't help at all.

Keep up the great work!

2 Answers

Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 27,696 Points

Michael,

Java*S*cript is case sensitive. This can lead to problems in your code.

Hint: see bold letter ^

Hope this helps!

–Rich

Michael Gardiner
Michael Gardiner
4,282 Points

sigh, something so simple as that haha yeah that worked thanks!

Henrique Zafniksi
Henrique Zafniksi
8,560 Points

The code is correct. If you are seeing errors, probably you are answering "Javascript" differently in the prompt, such as "javascript", or "JAVASCRIPT", or "javaScripT".

JavaScript is a code sensitive language, which means "JavaScript" === "javascript" will evaluate false.

To make sure you got it all right, you can try the .toUpperCase() method. This method will compare the uppercase version of the two strings.

   if(answer.toUpperCase() === "JavaScript".toUpperCase()) {
      alert("You are correct");
   }