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 trialRene Blansette
2,164 PointsI'm stumped by the java script challenge
I've been trying for days to do this challenge JavaScript. The idea is to have a conditional statement that checks to see if variable a is greater than variable b. If a is greater than b, there is a states saying so. Same goes is a isn't greater than b. But I keep getting the error message that it doesn't see the message that a isn't greater than b, even though a window pops up with the else alert thingy. What am I doing wrong?
var a = 10;
var b = 20;
var c = 30;
if ( a > b) {
alert('a is greater than b.');
} else {
alert('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
Jennifer Nordell
Treehouse TeacherHi there! Your code is functional, and your logic/syntax are spot on. But you haven't exactly matched the specifications of the challenge. These must be followed to the letter. You've included periods in both your strings and the word "not" is supposed to be all upper case: "NOT".
The two correct alerts are:
alert('a is greater than b');
alert('a is NOT greater than b');
Hope this helps!
Rene Blansette
2,164 PointsRene Blansette
2,164 PointsA period. I've been stymied all this time by a @#%&!! period. Thanks.