A Pen by webinsation on CodePen.
Created
January 26, 2015 20:45
-
-
Save webinsation/cc439957bbef77caac3e to your computer and use it in GitHub Desktop.
isEven number function
This file contains 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
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