How do I make this JS function asynchronous?

后端 未结 4 917
时光说笑
时光说笑 2021-02-04 02:58
function takesTime(){

    for (var i = 0; i

        
4条回答
  •  有刺的猬
    2021-02-04 03:03

    Javascript is event-based, and everything happens in a single thread. The way for you to make it "asynchronous" is to use a timeout (setTimeout()).

提交回复
热议问题