javascript - JS "Greater than" operator; -
this expression:
'33.33' > '100.00' return true. why?
if work like:
+'33.33' > +'100.00' it must return false because 33.33 < 100;
if like:
'33.33'.length > '100.00'.length then false, because 5 < 6;
i'm interested know, how work in first case;
ok. feel ashamed. while wrote & formated post, find answer.
for string compare js use lexicographical order; so, in case have just:
'3' > '1' and it's true.
maybe interesting someone.
Comments
Post a Comment