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 trialWayne Yuen
8,838 PointsWhy "a" > "b" is wrong? Do I have some misunderstanding about the question?
As the title.
"a" > "b"
2 Answers
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsYou are comparing 2 strings.
And "a" is not greater than "b" because it comes after the a.
The best way is to compare the ASCII values for those 2 chars:
"a" has a decimal value of 97 and "b" has "98" meaning that 97 is not greater than 98 which evaluates to FALSE.
Hope this helped to clear things a bit.
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsMy bad... didn't see that you are on a challange :)
a > b
The challenge says you have to compare variables a and b. By writting "a" > "b" you are comparing two strings and not variables.
Wayne Yuen
8,838 PointsWayne Yuen
8,838 PointsThank you! I misunderstood the question. It say two variable:
a > b