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 trialAshley Abid
863 PointsWhat's wrong with my conditional statement?
Hello!
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")
}
<!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>
1 Answer
Geoff Parsons
11,679 PointsYour 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!
Ashley Abid
863 PointsAshley Abid
863 PointsOh, thank you so much! And, no worries-I'm sure the strict syntax makes for good practice in the future! :)