Last active
May 23, 2022 06:38
-
-
Save tasseff/7208635 to your computer and use it in GitHub Desktop.
A recursive power function in Javascript.
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
| function power(base, exponent) { | |
| if (exponent == 0) | |
| return 1; | |
| else | |
| return base * power(base, exponent - 1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great