Sum of the series 0.6 , 0.06 , 0.006 , 0.0006 , ... to n terms | function which return the the sum of series ; Driver Code
function sumOfSeries ( n ) { return ( 0.666 ) * ( 1 - 1 / Math . pow ( 10 , n ) ) ; } let n = 2 ; document . write ( sumOfSeries ( n ) . toFixed ( 5 ) ) ;