Recursion, Iteration & JavaScript: A love story
summary
Claims JavaScript can unite recursion and iteration: custom Iterables let recursive logic drive intuitive for‑loops, and tail calls let recursion run without growing the stack. Builds an iterable tree by implementing Symbol.iterator with a generator using yield / yield so a for loop yields node values; that part works and reads like the recursive version. Rewrites recursion into a tail form with an accumulator so engines with tail call optimization* (Safari, Node6+flags) handle 30,000 depth; engines without it still hit stack overflow.
AI-written summary · about
chapters (5)
related talks
38mRecursion, Iteration, and JavaScript A Love Story
01h 04mRecursion has never been invented: A tale of intrigue
11mTail Call Optimization: The Musical!!
28mWhat happens next: a choose-your-own-adventure with iterators
11mDeployed Math
11mDeployed math
15mI Yield for Generators
27mA, B, C. 1, 2, 3. Iterables you and me
