Why is 'a' > 'A' true? [duplicate]

  • A+
Category:Languages

This question already has an answer here:

I was taking a course that was talking about operators and during an exercise this example came up stating that 'a' > 'A' === true. It didn't explain why it is true. I've tried researching a bit on my own and thought maybe it has something to do with Lexicographical order, but that didn't seem right. I also checked to see if it had something to do with the location on the ASCII and Unicode alphabet, but that doesn't seem to be the case either. Can someone explain why lowercase 'a' is greater than uppercase 'A' in JavaScript?

 


Because a IS > than A in ASCII and lower end UTF8

console.log("a > A is","a">"A","because a is","a".charCodeAt(0),"and A is","A".charCodeAt(0))

related: Is there any logic behind ASCII codes' ordering?

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: