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 (Retired) Making Decisions with Conditional Statements Review Conditional Statements and Comparison Operators

chris eaton
chris eaton
1,159 Points

clarification of comparisons of strings

during the quiz in the javascript conditionals section, a question was asked about which string was greater than another. 'lion' > 'zebra' true or false? i put true, because l comes before z in the alphabet, but i got it wrong. could you please clarify this for me? thank you so much

1 Answer

Julien riera
Julien riera
14,665 Points

It's actually the other way around.

"L" comes before "Z", so earlier in the alphabet order. So L < Z. Replace the actual letter by his rank number (L = 12 and Z = 26), it should help for future reference.

Cheers,

Moderator Edited: Moved response from Comment to Answer section