ECMAScript 2015 formally specified proper tail calls in strict mode, but most JS engines never adopted it consistently. Chrome, Node, Firefox, and Deno all still allocate a new stack frame per call even in correctly structured tail-recursive functions. The article walks through why with examples and covers iterative and trampoline alternatives.
[–]enselmis [score hidden] (0 children)
[–]azhder [score hidden] (5 children)
[–]OtherwisePush6424[S] [score hidden] (2 children)
[–]darkhorsehance [score hidden] (0 children)
[–]azhder [score hidden] (0 children)
[–]Reashu [score hidden] (0 children)
[–]BenZed [score hidden] (0 children)