web-links (blinks) web-log (blog) by Dragan Sretenovic
Scott Robinson on X: "I often forget that, by default, JavaScript sorts integers as if they were strings. 1) This makes no sense 2) I can't imagine how many bugs are sprinkled throughout all the JS code I've written in the last 8 years https://t.co/6yv2ITXRa9" / X
this is hard to believe.... but true :(
array sort in JavaScript is handling numeric values as STRINGS!
[2,13,54].sort() > [13, 2, 54]
Scott Robinson (@ScottWRobinson) / X
Post a Comment
No comments:
Post a Comment