LoginSignup
0
0

More than 3 years have passed since last update.

JavaScript でタイマー処理

Posted at

JavaScript でタイマー処理を実装するには setInterval を使う。

function func() {
  // 一定時間ごとに実行したい処理
};

const delay = 1000; // 遅延時間。単位はミリ秒

const intervalID = setInterval(func, delay); // 戻り値はタイマーを識別する正の整数

clearInterval(intervalID); // intervalID のタイマーをキャンセルする
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0