Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: