Created
March 20, 2019 23:24
-
-
Save marsrvr/19bcc39eb6a433d73969d6443a0ebbd1 to your computer and use it in GitHub Desktop.
IvanOnTech Academy Smart Contract Programming Eloquent JavaScript Chapter 3 Exercises: recursive isEven( )
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(n) { | |
if (n == 0) return true; | |
if (n == 1) return false; | |
if (n < 0) return isEven(-n); | |
return isEven(n - 2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment