setInterval模拟setTimeout

# setInterval模拟setTimeout

const mySetTimeOut = (fn, time, ...args) => {
  const timer = setInterval(() => {
    clearInterval(timer);
    fn.apply(this, args);
  }, time);
};
1
2
3
4
5
6
上次更新: 2022/7/28 下午9:01:35