Diagonal of a Regular Hexagon | Function to find the diagonal of a regular hexagon ; Side cannot be negative ; Length of the diagonal ; Driver code
function hexDiagonal ( a ) { if ( a < 0 ) return - 1 ; var d = 1.73 * a ; return d ; } var a = 9 ; document . write ( hexDiagonal ( a ) ) ;