SetTimeout with standard counter

前端 未结 4 1576
北恋
北恋 2021-01-29 03:59

I want to create a alert \"Hello\" which will show up after 10sec. I used setTimeout and it working fine. Now i would like to do counter(timer) which will show 10, 9, 8,7 ...

4条回答
  •  無奈伤痛
    2021-01-29 04:16

    The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds).

    you can stop evaluates by clearTimeout() function.

    Try the code

    }, 1000)

提交回复
热议问题