2 ms·
Even with plain Javascript, `Infinity % 2` evaluates to `NaN`, as it should. And if you implement, e.g.: function IsEven(x) { return x % 2 == 0; } funct
by sltkr 3y ago
Even with plain Javascript, `Infinity % 2` evaluates to `NaN`, as it should.
And if you implement, e.g.:
function IsEven(x) { return x % 2 == 0; }
function IsOdd(x) { return x % 2 == 1; }
Then IsEven(Infinity) == false and IsOdd(Infinity) == false, as expected.