Recursive Function

Problem

Write a program that outputs 1 to N using a recursive function when a natural number N is input.

input

In the first line, an integer N (3<=N<=10) is entered.

3

output

print on the first line

1 2 3

Solution

function solution(n) {
	function DFS(L) {
		if (L === 0) return;
		console.log(L);
		DFS(L - 1);
	}

	DFS(n);
}