📜  js 每 x 秒 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:23.982000             🧑  作者: Mango

代码示例3
// your function
function myTimer() {
    console.log(' each 1 second...');
}

var myVar = setInterval(myTimer, 1000); //setting the loop with time interval

clearInterval(myVar); //call this line to stop the loop