1 min readDec 17, 2016
f(x+1) is not a tail call here:
function f(x) { console.log(x); f(x + 1); }
That’s because this code is equivalent to:
function f(x) { console.log(x); f(x + 1); return undefined; }
The rules for tail calls are in the spec. I’ve summarized them here: http://exploringjs.com/es6/ch_tail-calls.html#_checking-whether-a-function-call-is-in-a-tail-position