1

This expression:

'33.33' > '100.00'

return true. Why?

If it 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 really interested know, how it work in the first case;

0

1 Answer 1

1

OK. I feel ashamed. While I wrote & formated this post, I find the answer.

For string compare JS use Lexicographical order; So, in this case we have just:

'3' > '1'

and it's really true.

Maybe it would be interesting for someone.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.