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 Making Decisions in Your Code with Conditional Statements Conditional Statements and Operators Review

Shouldn't the answer to this be True? Is 'l' greater than 'z'?

( 'lion' > 'zebra' )

When comparing two strings, we compare the first letter of the first string with the first letter of the second string. Since 'l' comes before 'z', the above statement should be true. But the quiz tells me I'm wrong.

Stangely, the explanation for both true and false in the quiz is exactly the same: l comes before z.

Am I missing something?

2 Answers

Steven Parker
Steven Parker
231,248 Points

Anything that "comes before" is considered to be "less than". So just as 3 comes before 8, and therefore 3 is less than 9; "l" comes before "z", so "l" is less than "z".

The descriptions in the quiz for the two choices differ by the word "not". The choice for "False" reads "Since 'l' comes before 'z' in the alphabet, 'lion' is not greater than 'zebra.'"

Thanks for that explanation. It makes logical sense.

To be honest, math was never my strongest subject. That's why I write programs, to do the math for me. :)

Michael Hicks
Michael Hicks
24,208 Points

I missed this too Eric Newcomb This has less to do with math and more to do with attention to detail.