Skip to content

Instantly share code, notes, and snippets.

@fson
Created June 7, 2015 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fson/ea45aaa49a3c2d800fb8 to your computer and use it in GitHub Desktop.
Save fson/ea45aaa49a3c2d800fb8 to your computer and use it in GitHub Desktop.
Mutually recursive modules
import odd from './odd';
export default function even(n) {
if (n === 0) {
return true;
}
return !odd(n - 1);
}
import even from './even';
export default function odd(n) {
if (n === 0) {
return true;
}
return !even(n - 1);
}
import even from './even';
console.log(even(5));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment