Debian Codegraph @

js/src/jit-test/modules/isEven.js

raw
1 import { isOdd } from "isOdd.js"
2
3 export function isEven(x) {
4 if (x < 0)
5 throw "negative";
6 if (x == 0)
7 return true;
8 return isOdd(x - 1);
9 }
10
11 assertEq(isEven(4), true);
12 assertEq(isOdd(5), true);