Recursion countdown function

function countup(n) {
 if (n < 1) {
   return [];
 } else {
   const countArray = countup(n - 1);
   return countArray;

The value [1, 2, 3, 4, 5] will be displayed in the console.

Here is recursion function with the result. The problem is I could not understand how it is working precisely step by step. Is there any one can explain it to me ?
Thanks in advance

This is how it works.

Thank You. Appreciate it :slightly_smiling_face:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.