+ 2
Console log problem
3 ответов
+ 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))
+ 5
They are not numbers but strings.
So we have iexicographical order and not numerical.