Largest square that can be inscribed within a hexagon which is inscribed within an equilateral triangle | Function to find the side of the square ; Side cannot be negative ; side of the square ; Driver code
function squareSide ( a ) { if ( a < 0 ) return - 1 ; var x = ( 0.423 * a ) ; return x ; } var a = 8 ; document . write ( squareSide ( a ) ) ;