Skip to content

Instantly share code, notes, and snippets.

@webinsation
Created January 26, 2015 20:45
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 webinsation/cc439957bbef77caac3e to your computer and use it in GitHub Desktop.
Save webinsation/cc439957bbef77caac3e to your computer and use it in GitHub Desktop.
isEven number function
function isEven(number) {
if (number == 0) {
return true
} else if (number == 1) {
return false
} else {
number = number % 2;
return isEven(number);
}
}
console.log(isEven(50));
console.log(isEven(75));
console.log(isEven(-1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment