Area of largest isosceles triangle that can be inscribed in an Ellipse whose vertex coincides with one extremity of the major axis | Function to calculate area of the isosceles triangle ; If a and b are negative ; Stores the area of the triangle ; Print the area ; Given value of a & b ; Function call to find the area of the isosceles triangle
function triangleArea ( a , b ) { if ( a < 0 b < 0 ) { document . write ( - 1 ) ; return ; } var area = ( 3 * Math . sqrt ( 3 ) * a * b ) / ( 4 ) ; document . write ( area . toFixed ( 5 ) ) ; } var a = 1 , b = 2 ; triangleArea ( a , b ) ;