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 Using Comparison Operators

what am i doing wrong???

yo, i;m not confused by this, but damn. i;ve been trying for a couple of days now to get this right... & i'm still having trouble.

script.js
var a = 10;
var b = 20;
var c = 30;
var answer = b;
if (a > b) {alert(' '+a+' is NOT greater than '+b+' ');}
else {alert(' '+a+' is NOT greater than '+b+' ');}
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="script.js"></script>
</body>
</html>
raquel pinto
raquel pinto
12,549 Points

I think you just have to put... if (a > b) {alert(' '+a+' is greater than '+b+' ');} instead of "is NOT greater than". I mean, your two statements say that is "NOT greater than", other than that, your code works...

1 Answer

Steven Parker
Steven Parker
229,787 Points

Both of your messages are the same.

Only the latter one should have the word "NOT" in it.

Also, do not add spaces before and after the message, that will confuse the checker.