Skip to content

Instantly share code, notes, and snippets.

@macikokoro
Created June 19, 2014 08:33
Show Gist options
  • Save macikokoro/3828235d0a1142278947 to your computer and use it in GitHub Desktop.
Save macikokoro/3828235d0a1142278947 to your computer and use it in GitHub Desktop.
Function to find out the power of a number.
var power = function (base, exponent) {
var result = 1;
for (var i = 0; i < exponent; i++) {
result = result * base;
}
return result;
};
power(2, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment