Created
August 27, 2014 16:00
-
-
Save sawant/15387b3c40fc185f94ea to your computer and use it in GitHub Desktop.
JavaScript Power Recursive
This file contains hidden or 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 power = function(base, exp) { | |
if (exp == 1) | |
return base; | |
else | |
return base * power(base, exp-1); | |
} | |
console.log(power(2, 7)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment