r/learnjavascript • u/grave4us • Apr 11 '26
Has anyone actually used string comparison? Tell me where might that come in handy?
like alert(“Y” > “A”); //true
0
Upvotes
r/learnjavascript • u/grave4us • Apr 11 '26
like alert(“Y” > “A”); //true
View all comments
Show parent comment
2
u/keel_bright Apr 11 '26 edited Apr 11 '26
To be fair, the obvious answer (sorting alphabetical strings) falls apart under any sort of scrutiny (mixed casings, special chars etc). And then the answer becomes then not so clear.
I had a similar question when I was first learning programming as a teen, even though I was already quite technical. I wanted to build an app, I get why you need to learn array manipulation methods to modify a list, but I never understood why tutorials would spend entire chapters teaching string methods like concatenation and substitution, they seemed like such a waste of time.