Program to find sum of harmonic series | Javascript program to find sum of harmonic series using recursion ; Base condition ; Driver code
function sum ( n ) { if ( n < 2 ) { return 1 } else { return 1 / n + ( sum ( n - 1 ) ) } } document . write ( sum ( 8 ) ) ; document . write ( " " ) ; document . write ( sum ( 10 ) ) ;