Find length of Diagonal of Hexagon | Function to find the diagonal of the hexagon ; side cannot be negative ; diagonal of the hexagon ; Driver code
function hexadiagonal ( a ) { if ( a < 0 ) return - 1 ; return 2 * a ; } var a = 4 ; document . write ( hexadiagonal ( a ) ) ;