Not sure how much of this article is or isn't AI in nature... the premise is interesting.
That said, using recursion in JS is asking for pain... you're best of rethinking an algorithm in such a way that removes recursion in favor of iteration. While some algorithms are intended to work best/easiest with recursion, it's usually a bad idea for JS.
Another issue tends to come down to trying to force immutable data usage, where mutation within a function/iterable is often a better use of the language in terms of overhead and performance. While not everything you do needs to be optimized, recursion is one of those things in JS where it's too easy to hit walls. Most runtimes do not have proper tail call optimizations for example.
Both in terms of JS limits as well as DOM limits, such as complexities that are less common today, but still pop up now and then. Nothing worse than a blank page that barely moves and soaks your CPU cycles.
If your timing structure is particularly tight, you might want to adapt an async iterable even... I really like that about the more modern stream designs in JS.