# Functions That Call Themselves

Functions That Call Themselves: How Big Is This Folder? Recursion, The Folder Tool That Never Stopped: Base Cases, Where Do the Waiting Calls Wait? The Call…

Updated: November 25, 2026

1. [How Big Is This Folder? Recursion](https://www.ask-codey.com/lessons/ds-recursion) (Apprentice): Work out how big a folder is when it holds folders, which hold more folders, as deep as anyone made them: why one loop, a loop in a loop and a loop per level all come up short, and the idea that fixes them, recursion.
2. [The Folder Tool That Never Stopped: Base Cases](https://www.ask-codey.com/lessons/ds-recursion-base-case) (Apprentice): Find out why the folder tool crashed on one customer's drive, and make every recursive function you write stop: why a bigger stack, catching the error and a depth limit all fall short, and the two rules of a base case that fix it.
3. [Where Do the Waiting Calls Wait? The Call Stack](https://www.ask-codey.com/lessons/ds-call-stack) (Apprentice): Trace any recursive function by hand, and see why recursion that goes too deep runs out of room: how a program keeps every waiting call's own values and the way back to it, which a single variable or a single bookmark can't do.
4. [5,000 Folders Deep: Recursion or a Loop?](https://www.ask-codey.com/lessons/ds-recursion-vs-loops) (Journeyman): Keep the folder tool working on a folder thousands of levels deep, where recursion runs out of call stack: why a bigger limit and a plain loop both fall short, how a loop with a pile of its own does the job, and how to choose between recursion and a loop for any task.

Source: https://www.ask-codey.com/courses/javascript-in-depth/topics/javascript-recursion
