Sum of the first N terms of the series 2 , 10 , 30 , 68 , ... . | Function to calculate the sum ; number of terms to be included in the sum ; find the Sum
function calculateSum ( n ) { return n * ( n + 1 ) / 2 + Math . pow ( ( n * ( n + 1 ) / 2 ) , 2 ) ; } let n = 3 ; document . write ( " " + calculateSum ( n ) ) ;