ES6 Tail Recursion Optimisation Stack Overflow : <p>Having read <a href="http://www.2ality.com/2015/06/tail-call-optimization.html" rel="noreferrer">Dr Rauschmayer's description</a> of recursive tail call optimisation in es6, I've since been trying to recreate the 'zero-stack' execution of the recursive factorial function he details.<br/><br/>
Using the Chrome debugger to step between stack frames, I'm seeing that the tail optimisation is not occurring and a stack frame is being created for each recursion.<br/><br/>
I've also tried to test the optimisation by calling the function without the debugger, but instead passing <code>100000</code> to the factorial function. This throws a 'maximum stack' error, which implies that it is, in fact, not optimised.</p>

<p>Here is my code:</p>

<pre><code>const factorial = (n, acc = 1) =&gt; n &lt;= 1 ? acc : factorial(n - 1, n * acc)
console.log( factorial(100000) )
</code></pre>

<p>Result:</p>

<pre><code>Uncaught RangeError: Maximum call stack size exceeded
</code></pre>
