Find the sum of the series 1 + 11 + 111 + 1111 + ... . . upto n terms | Function for finding summation ; Driver Code
function summation ( n ) { let sum ; sum = ( Math . pow ( 10 , n + 1 ) - 10 - ( 9 * n ) ) / 81 ; return sum ; } let n = 5 ; document . write ( summation ( n ) ) ;