Re:WTFJS – a list of funny and tricky JavaScript examples
by roywiggins on Monday July 31, 2017 @01:30PM
(#14894106)
As long as you can define what's going on rigorously, it's just mathematics :) The equality operator means just what I choose it to mean- neither more nor less, as Humpty Dumpty would say.
Also fun: (NaN < x) should be false for every x, and (NaN > x) should be false for every x. It's not a number, so it's not less than or greater than any number. But then by process of elimination, NaN == x for every x. Which is obviously nonsense. So equality and comparison is completely "broken" anyway when you start comparing NaN to things.
Also fun: (NaN < x) should be false for every x, and (NaN > x) should be false for every x. It's not a number, so it's not less than or greater than any number. But then by process of elimination, NaN == x for every x. Which is obviously nonsense. So equality and comparison is completely "broken" anyway when you start comparing NaN to things.