Skip to content

Instantly share code, notes, and snippets.

@adamzap
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamzap/f3e3d1f4c2d972f958b8 to your computer and use it in GitHub Desktop.
Save adamzap/f3e3d1f4c2d972f958b8 to your computer and use it in GitHub Desktop.
Recursive even and odd functions in JavaScript
function even (num) {
return (num === 0) || odd(num - 1)
};
function odd (num) {
return (num > 0) && even(num - 1)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment