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!
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

Louise Turner
710 PointsCondition if else statement trouble
I can't seem to get this correct and not sure why this isn't passing
var a = 10; var b = 20; var c = 30;
if (a > b ){ alert('a is greater than b'); } else (a < b){ alert('a is not greater than b'); }
2 Answers

Shawn Flanigan
Courses Plus Student 15,815 PointsHi Louise: I haven't looked at the challenge, but just glancing at your code...you seem to be missing an opening curly brace after "else". You've also got an extra "a" thrown in before your second alert statement.

Louise Turner
710 PointsHi Shaun,
Thanks for your help. I'm completing 'Javascript Basics' and the challenge 'Review Conditional Statements and Comparison Operators '
I've just tried the code again with your suggestions and it's worked!
Thanks :)
Shawn Flanigan
Courses Plus Student 15,815 PointsShawn Flanigan
Courses Plus Student 15,815 PointsLouise: I'm having a hard time tracking down the challenge you're completing, but syntax errors aside, the logic of your code looks good. In the end, the following code works...but without seeing the challenge, it's hard to say if it will meet all of the objectives.
If this still isn't passing, please let us know which course you're taking and the title of the challenge and I'll look into it.
Hope that helps!