-
-
Save esfand/6aae8e8afcce3439021f to your computer and use it in GitHub Desktop.
Mutually recursive modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import odd from './odd'; | |
export default function even(n) { | |
if (n === 0) { | |
return true; | |
} | |
return !odd(n - 1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import even from './even'; | |
export default function odd(n) { | |
if (n === 0) { | |
return true; | |
} | |
return !even(n - 1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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