javascript: tailcalls without exceptions