4 ms·
Not defending isOdd in any way, but the example shows that even something as clear-cut as testing a number for oddness isn't that easy to get right: isOdd(-1)
by firebaze 2y ago
Not defending isOdd in any way, but the example shows that even something as clear-cut as testing a number for oddness isn't that easy to get right:
isOdd(-1) === false
(-1 % 2 === -1)
- aidos 2y agoHa! Good catch. You’d think that with a math degree including algebraic number systems I would have spotted that.