In js, there are two types of delayed execution functions, setTimeout and setInterval, and the usage is as follows:
function testFunction(){Console.log('hovertree.com');}setTimeout("testFunction()","6000"); //Execute the testFunction() function after 6000 milliseconds, only once. setInterval("testFunction()","6000");//Execute the testFunction() function every 6000 milliseconds, and execute countless times. variinterval = window.setInterval("testFunction()","6000");// window.clearInterval(interval); // Stop executing the setInterval loop.When we want the testFunction() function to be executed every 6000 milliseconds and stop execution after 10000 milliseconds, we can use the combination of the two to achieve this.
variinterval2 = window.setInterval("testFunction2()",6000);setTimeout(function() {window.clearInterval(interval2);},10000);The above brief discussion on delayed execution and timed execution in js is all the content I share with you. I hope it can give you a reference and I hope you can support Wulin.com more.