javascript: tailcalls without exeception