Program to find sum of series 1 + 2 + 2 + 3 + 3 + 3 + . . . + n | Function that find sum of series . ; Driver Code
function sumOfSeries ( n ) { return ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6 ; } var n = 10 ; document . write ( sumOfSeries ( n ) ) ;