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 trialmarci villa
975 PointsI think this is right, can't see why the first task no longer works
thanks!
var answer = prompt("what is the best programming language?");
if (answer.toUpperCase === JAVASCRIPT) {
document.write("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
LaVaughn Haynes
12,397 PointsYou have a couple of small mistakes
var answer = prompt("what is the best programming language?");
//Put your string in quotes. Use parenthesis with your method
//if (answer.toUpperCase === JAVASCRIPT) {
if (answer.toUpperCase() === "JAVASCRIPT") {
//add semicolon
//document.write("You are correct")
document.write("You are correct");
}
marci villa
975 Pointsah! i see thank you
marci villa
975 PointsOk, tried that and got ... There was an error with your code: TypeError: 'null' is not an object (evaluating 'answer.toUpperCase')
var answer = prompt("what is the best programming language?") if (answer.toUpperCase() === "JAVASCRIPT") { document.write("you are correct"); }
LaVaughn Haynes
12,397 Pointspaste your code here
marci villa
975 Pointsvar answer = prompt("what is the best programming language?") if (answer.toUpperCase() === "JAVASCRIPT") { document.write("you are correct"); }
LaVaughn Haynes
12,397 PointsThe only thing wrong with that is that you are missing a semicolon after the parenthesis and before the if
...programming language?"); if (ans...
marci villa
975 PointsI added the ; and it still said answer.toUpperCase was null....so strange thank you for you help!
LaVaughn Haynes
12,397 PointsTry this code as it's listed below and let me know if it works
var answer = prompt("what is the best programming language?");
if (answer.toUpperCase() === "JAVASCRIPT") {
document.write("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>