summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/modules/isOdd.js
blob: 2cada0cf939a1df605bd276dbd9ab18edb264a7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { isEven } from "isEven.js"

export function isOdd(x) {
    if (x < 0)
        throw "negative";
    if (x == 0)
        return false;
    return isEven(x - 1);
}

assertEq(isEven(4), true);
assertEq(isOdd(5), true);