Why? https://code.sololearn.com/Wo2a3RZi9E2r/?ref=app
2/20/2020 4:50:38 AM
setu kumar3 Answers
New AnswerJust 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))
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message