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 trialkeller greathouse
4,823 PointsAdd a conditional statement that tests if the value in variable a is greater than the value in variable b. If it is, log
The error is telling me that I am not logging in that a is not greater than b. But I clearly am in my else conditional.
var a = 10;
var b = 20;
var c = 30;
if (a>b){console.log("a is greater than b.");}
else {console.log("a is NOT greater than b.");}
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
1 Answer
Travis Alstrand
Treehouse Project ReviewerThis is one of those times where it's unfortunate how picky the backend of the challenge is being. What you have is fine, though I'm not sure why the change from const
s to var
s but that doesn't matter for this one.
You just need to remove the periods from the end of your console log strings.
var a = 10;
var b = 20;
var c = 30;
if (a>b){console.log("a is greater than b");}
else {console.log("a is NOT greater than b");}
keller greathouse
4,823 Pointskeller greathouse
4,823 PointsThank you! I do not know why it made a deal about my periods in that statement.
Travis Alstrand
Treehouse Project ReviewerTravis Alstrand
Treehouse Project ReviewerI know some of these challenges are extremely specific in what they want. I'm sorry you got held up on that one but at least your logic and code was valid and correct!