text: Write a program to calculate pow ( x , n ) | javascript program for the above approach ; If x ^ 0 return 1 ; If we need to find of 0 ^ y ; For all other cases ; Driver Code
code: function power ( x , y ) { if ( y == 0 ) return 1 ; if ( x == 0 ) return 0 ; return x * power ( x , y - 1 ) ; } var x = 2 ; var y = 3 ; document . write ( power ( x , y ) ) ;