Find sum of the series 1 + 22 + 333 + 4444 + ... ... upto n terms | Javascript Program to find Sum of first n terms ; Returning the const sum ; no . of terms to find the sum
function calculateSum ( n ) { return ( parseInt ( Math . pow ( 10 , n + 1 ) ) * ( 9 * n - 1 ) + 10 ) / parseInt ( Math . pow ( 9 , 3 ) ) - n * ( n + 1 ) / 18 ; } let n = 3 ; document . write ( " " + calculateSum ( n ) ) ;