JS ES6 Recursive Tail Call Optimization
Michael Laythe
513

So ‘call stack size exceeded’ is happening in the first scenario, because the recursive call in the return statement is performing closure over the scope of the previous recursive call; i.e. it keeps a reference to the previous recursive call function’s lexical scope because of the local ‘base’ variable in it.

Makes sense.