While loops using Await Async.

后端 未结 4 1698
旧时难觅i
旧时难觅i 2020-12-29 04:24

This Javascript function seems to use the while loop in an asynchronous way. Is it the correct way to use while loops with asynchronous conditions?

 var Boo         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 04:55

    Is it the correct way to use while loops with asynchronous conditions?

    Yes. async functions simply suspend their execution on every await until the respective promises fulfills, and any control structures continue to work as before.

提交回复
热议问题