Hacker News new | ask | show | jobs
by 52-6F-62 2837 days ago
Too true.

‘a-b’ is safe enough in JS if you always know the input will be within a safe range regarding integer sizes and types.

NaN can give you all kinds of trouble so I’d usually test for that in a real case, either before the sort or in the comparator—if necessary.