JavaScript compares strings by their Unicode character codes rather than by visual alphabetical order, meaning uppercase letters (A-Z: 65-90) have lower character codes than lowercase letters (a-z: 97-122), so 'Z' < 'a' evaluates to true, and string numbers are compared by their character codes (e.g., '4' < '5' is true because 52 < 53).
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Comparing Strings in JavaScriptAdded:
Can you guess all three outputs?
Comment your answer below, and the correct one is C. You should know that.
JavaScript doesn't compare letters the way we do. It compares their character codes under the hood. Char code of uppercase A is 65, and uppercase Z is 90. It gives false. Then, the lowercase A is 97. So, this line returns true.
Third line, is 4 greater than 5? This one looks simple, but remember, these are strings, not numbers. JavaScript again compares the character codes of 4 and 5, which are 52 and 53. So, string 4 is less than string 5, and the answer is false. So, the rule is simple.
JavaScript compares strings by their character codes, not by what they look like to us. If you want to master JavaScript concepts like this easily, my ebook is linked in bio.
Related Videos
resume fixed instantly 😭 Comment “app”andI’ll sendyou the link #parakeetaipartnership #resumetips
Ritcareer
686 views•2026-05-31
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
3D Basics in C
HirschDaniel
2K views•2026-06-05
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
Making Minecraft Clone with C++ & Raylib
PecaCSLive
686 views•2026-06-04
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Instagram accounts got PWNed
EricParker
13K views•2026-06-03
So What's Odin Lang Even Good For
TechOverTea
131 views•2026-06-01











