Re:Math.min(Math.max(num, min), max)
by dfabulich on Thursday August 20, 2020 @07:12PM
(#24230105)
Beware that in JavaScript, the language that this tweet is about, the sort function sorts alphabetically by default.
[ Parent
| on HN ]
Most popular programming language folks. You give it 3 numbers and it treats them as 3 strings of characters...
Re:Math.min(Math.max(num, min), max)
by earthboundkid on Thursday August 20, 2020 @10:47PM
(#24231463)
Wait, really?
BRB, just checking some code…
Yep, the sort method converts values to strings before comparing.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...