LoginSignup
1
1

More than 5 years have passed since last update.

javascriptで非同期無限ループするときに即時関数つかう

Last updated at Posted at 2017-05-30

即時関数使う方法毎回忘れるのでメモ。

(function loop() {
  // do something
  setTimeout(loop, 1000);
})();

こっちならすぐ思い出すんだけどなぁ。即時関数をすぐ忘れる模様。

var loop = function() {
  // do something
  setTimeout(loop, 1000);
};
loop();
1
1
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
1
1