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

Liam Smith
Liam Smith
1,407 Points

Can someone help me to understand this question. I thought the answer was true as the L in Lion comes before the Z

Can someone help me to understand this question? I thought the answer was true as the L in Lion comes before the Z in Zebra in the alphabet, making Lion greater than Zebra. Thanks

4 Answers

Steven Parker
Steven Parker
231,261 Points

Think about numbers for a moment. For example, 3 comes before 5 — so 3 is less than 5.

Likewise in letters, L comes before Z — so L is less than Z.

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

Hi Liam Smith, when comparing strings, the first letter of the first string is compared to the first letter of the second string.

Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 27,696 Points

JavaScript strings are compared by their Unicode values. Take a look at this table and refer even to the Decimal values (e.g. l: 108 vs. z: 122), which might make a little more sense.

Liam Smith
Liam Smith
1,407 Points

Thank you very much for your help everyone. I think I misunderstood that bit in the track.