Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@RinatValiullov
Last active November 9, 2017 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RinatValiullov/aeb047cb4edf95ea9b8667be1eae00b2 to your computer and use it in GitHub Desktop.
Save RinatValiullov/aeb047cb4edf95ea9b8667be1eae00b2 to your computer and use it in GitHub Desktop.
JS Bin// source http://jsbin.com/zemucav
var pow=  function (x, n){
  
  if( n !== 1 ) {
    return (x * pow(x, n-1));
  } else {
    return x;
  }
  
};

console.log(pow(3, 3)); // 3**3 = 27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment