# 调度

  • setTimeout 允许我们将函数推迟到一段时间间隔之后再执行。
  • setInterval 允许我们重复运行一个函数,从一段时间间隔之后开始运行,之后以该时间间隔连续重复运行该函数。

# setTimeout

let timerId = setTimeout(func|code, [delay], [arg1], [arg2], ...);
clearTimeout(timerId);

# setInterval

let timerId = setInterval(func|code, [delay], [arg1], [arg2], ...)
clearInterval(timerId);