Find n | Function to find the nth term of series ; Loop to add numbers ; Driver code
function term ( n ) { let ans = 0 ; for ( let i = 1 ; i <= n ; i ++ ) ans += i ; return ans ; } let n = 4 ; document . write ( term ( n ) ) ;