Execute script after specific delay using JavaScript

前端 未结 15 2016
陌清茗
陌清茗 2020-11-22 12:29

Is there any JavaScript method similar to the jQuery delay() or wait() (to delay the execution of a script for a specific amount of time)?

15条回答
  •  臣服心动
    2020-11-22 12:42

    There is the following:

    setTimeout(function, milliseconds);
    

    function which can be passed the time after which the function will be executed.

    See: Window setTimeout() Method.

提交回复
热议问题