Hey, I need help understanding recursion in-depth in js.
when I add console .log to the example to see what’s it doing step by step during the recursion, this is what I get for this code:
it seems to restart the array every time until it get to 5 and I got confused, I don’t fully understand what is happening in every step in the call stack
The thing is , your console.log makes additional function calls and it confuses you even more, for this case console-logging is not the best way to understand stuff
Grab your code(preferrably without console.log line, it will add some more confusion), and check it there. If you will have more questions after, feel free to deliver them)
Edit. I guess you can use logging also, like this: