Largest Square that can be inscribed within a hexagon | Function to find the area of the square ; Side cannot be negative ; Area of the square ; Driver code
function squareArea ( a ) { if ( a < 0 ) return - 1 ; var area = ( Math . pow ( 1.268 , 2 ) * Math . pow ( a , 2 ) ) ; return area ; } var a = 6 ; document . write ( squareArea ( a ) . toFixed ( 5 ) ) ;