3 ms·
In Javascript, NaN (not a number) is a number: >> typeof NaN <- "number" Let's see then: >> (NaN % 2) == 0 <- false So clearly NaN is odd. /s (And
by deathanatos 2y ago
In Javascript, NaN (not a number) is a number:
>> typeof NaN
<- "number"
Let's see then:
>> (NaN % 2) == 0
<- false
So clearly NaN is odd. /s
(And if you're thinking "you gotta equals harder":
>> (NaN % 2) === 0
<- false
Nope, still odd.
Both of the infinities are also odd by the same logic, too, if you were curious.
null and false are even. true is odd. [] is even, [0] is even, [1] is odd.)