How to perform an action every couple of seconds?

后端 未结 6 1823
终归单人心
终归单人心 2020-12-20 14:25

Can someone quickly and simply explain to me how to perform an action every couple of seconds using

var timeOut = setTimeout(FunctionName, 5000);
         


        
6条回答
  •  一个人的身影
    2020-12-20 15:02

    var myFunction = function() { 
         //Do stuff
         AnotherFunction();
    };
    
    var timeOut = setInterval(myFunction, 2000);
    

提交回复
热议问题