20th Feb 2020, 4:50 AM
setu kumar
setu kumar - avatar
3 Respostas
+ 6
Just adding more to Oma's answer. Strings are compared in lexographical (dictionary) order according to their unicode value. Just an example : compare "abc" and "abd" which one is greater? comparison start at 0th charecter. "a" and "a" both equal, check next charecter. "b" and "b" both equal, check next charecter. "c" and "d" are NOT equal, "d" is certainly greater. therefore "abd" is greater than "abc" You can check utf representation of charecters using codePointAt() method. alert("a".codePointAt(0))
20th Feb 2020, 5:07 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 5
They are not numbers but strings. So we have iexicographical order and not numerical.
20th Feb 2020, 4:58 AM
Oma Falk
Oma Falk - avatar
20th Feb 2020, 5:33 AM
setu kumar
setu kumar - avatar