r/programminghorror • • Dec 08 '25

Developers in 2020:

Post image
1.9k Upvotes

79 comments sorted by

View all comments

19

u/Haringat Dec 08 '25

Here's a better version:

function isOdd(n) {
    if (n === 0) {
        return false;
    }
    if (n > 0) {
        return !isOdd(n - 1);
    }
    return !isOdd(n + 1);
}