how to make a sleep in javascript?

后端 未结 9 2053
半阙折子戏
半阙折子戏 2020-12-20 23:00

Does anyone know how can I make a sleep in javascript before next line been read by the system?

example:

    1 var chkResult = Validation();
    2 /         


        
9条回答
  •  星月不相逢
    2020-12-20 23:36

        1 var chkResult = Validation();
        2 alert("wait ten seconds, then press ok");
        3       
        4 document.getElementById('abc').innerHTML = chkResult;
    

    The preceeding code delegates the sleep task to a parallel processor. This is a little messy because you have to use a DSL for this style of threading.

提交回复
热议问题