Find the larger exponential among two exponentials | Function to find whether a ^ b is greater or c ^ d ; Find b * log ( a ) ; Find d * log ( c ) ; Compare both values ; Driver code
function compareValues ( a , b , c , d ) { let log1 = Math . log ( a ) / Math . log ( 10 ) ; let num1 = log1 * b ; let log2 = Math . log ( c ) / Math . log ( 10 ) ; let num2 = log2 * d ; if ( num1 > num2 ) document . write ( a + " " + b ) ; else document . write ( c + " " + d ) ; } let a = 8 , b = 29 , c = 60 , d = 59 ; compareValues ( a , b , c , d ) ;