Sum of internal angles of a Polygon | Function to return the sum of internal angles of an n - sided polygon ; Driver code
function sumOfInternalAngles ( n ) { if ( n < 3 ) return 0 ; return ( n - 2 ) * 180 ; } let n = 5 ; document . write ( sumOfInternalAngles ( n ) ) ;