summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/modules/isOdd.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/modules/isOdd.js')
-rw-r--r--js/src/jit-test/modules/isOdd.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/js/src/jit-test/modules/isOdd.js b/js/src/jit-test/modules/isOdd.js
new file mode 100644
index 000000000..2cada0cf9
--- /dev/null
+++ b/js/src/jit-test/modules/isOdd.js
@@ -0,0 +1,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);