Find the altitude and area of an isosceles triangle | function to find the altitude ; return altitude ; function to find the area ; return area ; Driver code
function altitude ( a , b ) { return Math . sqrt ( Math . pow ( a , 2 ) - ( Math . pow ( b , 2 ) / 4 ) ) ; } function area ( b , h ) { return ( 1 * b * h ) / 2 ; } let a = 2 , b = 3 ; let h = altitude ( a , b ) ; document . write ( " " + h . toFixed ( 2 ) + " " ) ; document . write ( " " + area ( b , h ) . toFixed ( 2 ) ) ;