javascript Call function 10 times with 1 second between

前端 未结 8 1845
花落未央
花落未央 2021-01-24 17:40

How to call a function 10 times like

for(x=0; x<10; x++) callfunction();

but with 1 sec between each call?

8条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-24 18:05

    setInterval(function(){},1000);
    

    Calls the function for every second...

    You can also use setTimeout for your thing to work.

提交回复
热议问题