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 trialLennie Polanco
14,415 Pointsjavascipt conditional number 1
my conditional isnt working
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>
5 Answers
eck
43,038 PointsIf src="app.js" on your script tag is the correct file path then it all looks right. Are you typing "Javascript" into the prompt correctly (all the proper capitalizations) ?
Lennie Polanco
14,415 Pointsvar answer = prompt("What is the best programming language?"); if(answer === "Javascript") {
alert("You are correct");
};
This did not work. frustrating...a bug?
eck
43,038 Pointsif(answer === "Javascript") is where you are incorrect. It needs to be if(answer === "JavaScript"). The capital S is important.
Lennie Polanco
14,415 Pointswooooooowww!! something so small...sheesh! You an tell i'm a noob.
Thank you Erik! I greatly appreciate your time and help!
Man, you have tons of points! I hope to be like you one day!
eck
43,038 PointsHa, no problem!
Keep at it and you will also be swimming in Treehouse points in no time :P
Lennie Polanco
14,415 Pointshaha Thanks! I just messaged you on your site btw. I would like to pick your brain a bit if you don't mind.
You're site is awesome btw and cool minesweeper! def a classic!
eck
43,038 PointsLennie, I got your messaging!
I will respond to you this evening, but first I have to go get some pizza or I will faint :P
Lennie Polanco
14,415 PointsHaha awesome! Buffalo Chicken bro! Can't go wrong...
Thank you.
eck
43,038 Pointseck
43,038 PointsTry typing answer === "JavaScript" in your if statement.
Lennie Polanco
14,415 PointsLennie Polanco
14,415 PointsYes I am. Correct file and I typed Javascript into the prompt and the conditional worked. I don't understand why it isn't letting me pass....so odd.