0 points

How Recursion Works — Explained with Flowcharts and a Video


dashboard

Wed Dec 02 2020 05:03:54 GMT+0000 (UTC)

Posted by @mvieira #javascript

function countdown(i) {
    console.log(i)  if (i <= 1) {  // base case
        return;
    } else {     // recursive case
        countdown(i - 1);
    }
}

countdown(5);    // This is the initial call to the function.
content_copy Copy

https://www.freecodecamp.org/news/how-recursion-works-explained-with-flowcharts-and-a-video-de61f40cb7f9/