How Recursion Works — Explained with Flowcharts and a Video

PHOTO EMBED

Wed Dec 02 2020 05:03:54 GMT+0000 (Coordinated Universal Time)

Saved 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_copyCOPY

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