Function to calculate power
function power ( a , b ) { if ( b == 0 ) return 1 ; if ( b == 1 ) return a ; let tmp = power ( a , Math . floor ( b / 2 ) ) ; let result = tmp * tmp ; if ( b % 2 == 1 ) result *= a ; return result ; }