DEV Community

Discussion on: The Only JavaScript Sorting Guide You'll Ever Need

Collapse
 
maxart2501 profile image
Massimo Artizzu

If two strings are equal, then the shortest one is put first.

If two strings are equal, none of them is shorter 😁
If one of them starts with the other (e.g. "longer" and "long"), it's put after.

Collapse
 
gregorygaines profile image
Gregory Gaines • Edited

Nice comment.

I meant in the context of being lexicographically equal, I should have been clearer.