using setTimeout synchronously in JavaScript

后端 未结 9 1732
无人及你
无人及你 2020-12-02 12:40

I have the following scenario:

setTimeout(\"alert(\'this alert is timedout and should be the first\');\", 5000);
alert(\"this should be the second one\");
         


        
9条回答
  •  抹茶落季
    2020-12-02 13:25

    No, as there is no delay function in Javascript, there is no way to do this other than busy waiting (which would lock up the browser).

提交回复
热议问题