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

What am I missing in this conditional statement coding challenge?

is it bugged or am i missing something? it keeps telling me to use === to compare answer to 'Javascript'

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>

2 Answers

Jason Desiderio
Jason Desiderio
21,811 Points

It looks like the error is in your capitalization of the 'S' in 'JavaScript'.

It should be answer === 'JavaScript'.

The whole valid answer looks like this:

var answer = prompt('what is the best programming language?');
if (answer === 'JavaScript') {
  alert('you are correct');
}

Thanks, that one lowercase letter was all that was throwing it off.

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Jason Desiderio is correct.

You're also going to want to capitalize the "Y" in your alert message. Most time, the challenges are VERY SPECIFIC and picky. If it says to put in a sentence with a period and you leave it out, it will throw an error. Many times, I've put a period instead of exclamation mark and couldn't figure why it wouldn't pass.

Keep coding! Jason