Skip to content

Instantly share code, notes, and snippets.

@alexandr-kazakov
Created February 2, 2017 07:49
Show Gist options
  • Save alexandr-kazakov/78a8ba9a65e76595a3181348147e47e4 to your computer and use it in GitHub Desktop.
Save alexandr-kazakov/78a8ba9a65e76595a3181348147e47e4 to your computer and use it in GitHub Desktop.
function pow(x,n) {
if (n != 1) {
return x *= pow(x,n - 1);
} else {
return x;
}
}
alert( pow(2,2,5)); // 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment