Tell us what’s happening:
hi
The explanation on recursion in my opinion in this challenge is not that understandable. I already got the answer I sought after spending much time searching. Even the help video has no video and has an article that doesn’t explain much.
The best video that helped to understand the call stack is this
I hope you will do some changes on the challenge for people not to get lost in it.
Many thanks
Your code so far
function countdown(n) {
// base case
if (n === 1) return [1];
const output = [n]; // [2]
return output.concat(countdown(n - 1)); // [2, 1]
}
countdown(5);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
.
Challenge: Replace Loops using Recursion
Link to the challenge: