If we have recursive calls stacked too high, we already know that our logic will fail. On the other hand, we know that tail calls should alleviate that problem... but don't, because of browser implementations! However, there's a way out for this. Let's first consider how we can transform recursive calls into tail calls, by using a well-known FP concept, continuations, and we'll leave the problem of solving TCO limitations for the next section. (We mentioned continuations in the Callbacks, promises, and continuations section of Chapter 3, Starting Out With Functions - A Core Concept, but we didn't go into detail at that point.)
In FP parlance, a continuation is something that represents the state of a process and ...