Find Cube root of a number using Log function | Function to find the cube root ; calculate the cube root ; Return the final answer ; Driver code
function cubeRoot ( n ) { let ans = Math . pow ( 3 , ( 1.0 / 3 ) * ( Math . log ( n ) / Math . log ( 3 ) ) ) ; return ans ; } let N = 8 ; document . write ( cubeRoot ( N ) . toFixed ( 2 ) ) ;