Largest hexagon that can be inscribed within an equilateral triangle | Function to find the side of the hexagon ; Side cannot be negative ; Side of the hexagon ; Driver code
function hexagonside ( a ) { if ( a < 0 ) return - 1 ; var x = a / 3 ; return x ; } var a = 6 ; document . write ( hexagonside ( a ) ) ;