Instead of real tail recursion, we use trampoline method:

      function foo(bar) {.... return function(){ foo(bar-1)}  }
      var f = foo(100);
      while(typeof(f) === "function")
        f = f()