JavaScript setInterval immediately run

前端 未结 5 1846
梦如初夏
梦如初夏 2021-01-22 09:28

I found a solution to run interval in javascript immidiately, not waiting for a first \"timeout\"

setInterval(function hello() {
  console.log(\'world\');
  retu         


        
5条回答
  •  离开以前
    2021-01-22 10:14

    Try this example

    var hello = function() {
      document.write('hello... ');
    };
    setInterval(hello, 1000);
    hello();

提交回复
热议问题