Currently learning JS.
Can't figure out at what point in this function "prev1" parameter somehow modified during recursion? If "console.log(prev1)" on each iteration "prev1" is actually modifies, although in none of the code below seems to change this parameter. Please, help me understand this thing.
function fibonacci(n, prev1, prev2){
//console.log(prev1);
var current = prev1 + prev2;
var fibonacci_string = current + " ";
if(n > 1)
fibonacci_string += fibonacci(n - 1, current, prev1);
return fibonacci_string;
}
console.log(fibonacci(10, 1, 0));
console.log(prev1):
1
1
2
3
5
8
13
21
34
55