DEV Community

Discussion on: Do you even recurse?... And if you do, do you do it safely?

Collapse
 
pichardoj profile image
J. Pichardo • Edited

That is right, the thunks would be allocated on the heap, so for a simple function like factorial a solution like this might just be overkill, however for more complex algorithms it could work. Still, I'm doing more research on the topic of continuation in javascript in order to find a way to improve efficiency.

@nestedsoftware @mortoray