📜  如何在设定的时间间隔 js 之后执行一个函数 - Javascript 代码示例

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

代码示例1
function sayHi() {
  alert('Hello');
}
//Do a function at a set interval continuously
setTimeout(sayHi, 1000);
//Do a function once after a set interval
setTimeout(sayHi, 1000);