Why is one string greater than the other when comparing strings in JavaScript?

Because, as in many programming languages, strings are compared lexicographically.

You can think of this as a fancier version of alphabetical ordering, the difference being that alphabetic ordering only covers the 26 characters a through z.


This answer is in response to a java question, but the logic is exactly the same. Another good one: String Compare “Logic”.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)