sprabhakaran
sprabhakaran

Reputation: 1635

JS Operator with String

Hii All,

"Aardvark" < "Zoroaster"  # return "true"

I think, this is very basic. But I can't understand above statement which is collected one of the js article.

Shall u explained them.

Upvotes: 1

Views: 207

Answers (2)

user348716
user348716

Reputation:

This basically means that in JS "Aardvark" is considered lesser than "Zoroaster" because JS uses something called Lexicographical Ordering, also known as Dictionary Order because dictionaries also use the same order when listing words.

Upvotes: 1

Phil
Phil

Reputation: 164766

You can compare strings using the equality, greater-than and less-than operators.

Using either greater-than or less-than will perform a dictionary style comparison, ie which comes first in the dictionary?

Upvotes: 2

Related Questions