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 trialTimothy Moran
2,730 PointsConditional statement in Javascript if ( a > b) else is not found
I'm thinking treehouse is expecting a particular layout of code as this works and executes ok from what i can see.
The error message i'm getting is " Bummer ! don't see the message 'a is NOT greater then b'
3 Answers
Aaron Loften
12,864 PointsYou spelled "than" as "then"
Aaron Loften
12,864 PointsCorrect it as "a is NOT greater than b"
I would directly copy and paste this as the result. It will be easier. Real clients will flip out when messages are different than expected as well. Copy and paste will cover your butt.
Timothy Moran
2,730 PointsCant believe it was that simple, thanks
Timothy Moran
2,730 PointsMy code is below
var a = 10;
var b = 20;
var c = 30;
if ( a > b ) {
alert("a is greater then b");
} else {
alert("a is not greater then b");
}
Jonathan Ankiewicz
17,901 Pointsvar a = 10; var b = 20; var c = 30;
if ( a > b ) {
alert("a is greater then b");
} else {
alert("a is NOT greater than b");
}
Aaron Loften
12,864 PointsHey Timothy,
It looks like you may have possibly forgotten the else portion. I am assuming they do not want an "else if" but it specifically says you have to have a handling for when it is not greater than b. That makes me think they may want an "else if" but id start with an "else" since treehouse likes to be direct.
Hope this helps.
IF it doesnt help, please post the entire code.
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsBrendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsCan you post your code?