r/programminghorror
•
u/Leonnee
•
Jun 12 '25
•
1
Javascript Javascript is filled with horror
2.4k
Upvotes
View all comments
Show parent comment
1
u/TorbenKoehn Jun 14 '25 edited Jun 14 '25
<produces a boolean in any language.It's not "Which value is smaller, a or b?"
It's "Is a smaller than b?" which obviously produces a boolean, not
-1 | 0 | 1Maybe you're talking about
<=>, which some languages have?Comparisons usually return one of 3 possible values,
LessThan (-1), Equal (0) and GreaterThan (1).<doesn't.What you're thinking of is
and it's way more complex than
(a, b) => a - b