Help to understand basic javascript step 112

Tell us what’s happening:
Describe your issue in detail here.
I can’t understand how countUp function works here and
why it returns [1,2,3,4,5] not [5,4,3,2,1] ??

  **Your code so far**

Function countup(n) {
if (n < 1) {
  return [];
} else {
  const countArray = countup(n - 1);
  countArray.push(n);
  return countArray;
}
}
console.log(countup(5));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36

Challenge: Use Recursion to Create a Countdown

Link to the challenge:

Yes, recursion is very confusing at first. There are many, many, many threads discussing recursion and many, many that deal with this exact functions, and many of those have detailed explanations. Rather than retype those 20 pages of explanation, I might recommend search back through previous threads and checking those out. I’m sure there is even a youtube video or two.

If, after that, you still have questions, please check back.

Just to be clear, that is not specific to JS. JS, like most (if not all) use a call “stack” - stacks are by definition LIFO.

my bad, I recalled it. you are right. I am sorry

No, what you said is useful information here. I just wanted to point out that it isn’t specific to JS.