Created
June 15, 2017 21:09
-
-
Save OneCent01/b4852415f71a714543819a57bfe30aca to your computer and use it in GitHub Desktop.
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
var exponent = function(base, exp) { | |
if(exp === 0) { | |
return 1; | |
} | |
if(exp < 0) { | |
return 1/(base * exponent(base, -(exp+1))); | |
} | |
return base * exponent(base, exp-1); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment