How to resolve recursive asynchronous promises?
问题 I'm playing around with promises and I'm having trouble with an asynchronous recursive promise. The scenario is an athlete starts running the 100m, I need to periodically check to see if they have finished and once they have finished, print their time. Edit to clarify : In the real world the athlete is running on a server. startRunning involves making an ajax call to the server. checkIsFinished also involves making an ajax call to the server. The code below is an attempt to imitate that. The