My code is not passing, though i have seen a solution that uses unshift instead of push but i dont know why it was used
**Your code so far**
// Only change code below this line
const arr = countdown(n-1);
// Only change code above this line
**Your browser information:**
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/220.127.116.11 Safari/537.36
Link to the challenge:
Did you try to log the output so you can compare the results with the expected one?
Some thing that are important to understand about recursion is that functions will return a value to where they where called, and there is a thing called the call stack. Read up on the call stack if you haven’t yet. Its why things can look like there going “in reverse” from what you expect them to be like with push or unshift. There are also many topics on these forums about recursion that go step by step explaining everything that is going on.
And there is a nice site that will let you put your code in and watch it run step by step. https://pythontutor.com/
Good luck, recursion can be annoying to understand
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.