Program to print triangular number series till n | Function to find triangular number ; For each iteration increase j by 1 and add it into k ; Increasing j by 1 ; Add value of j into k and update k ; Driven Function
function triangular_series ( n ) { let i , j = 1 , k = 1 ; for ( i = 1 ; i <= n ; i ++ ) { document . write ( k + " " ) ; j = j + 1 ; k = k + j ; } } let n = 5 ; triangular_series ( n ) ;