Skip to content

Instantly share code, notes, and snippets.

@sawant
Created August 27, 2014 16:00
Show Gist options
  • Save sawant/15387b3c40fc185f94ea to your computer and use it in GitHub Desktop.
Save sawant/15387b3c40fc185f94ea to your computer and use it in GitHub Desktop.
JavaScript Power Recursive
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