Ad
  • Custom User Avatar

    Hi, you can wrap your code by using the markdown syntax which will make your code more readable.

  • Custom User Avatar

    I just implement this funtionality with recursion:

    function pow(a, b) {
        if (b === 0) {
            return 1;
        }
    
        return pow(a, b-1) * a;
    }
    
    pow(2, 3) // 8
    pow(3, 3) // 27