This question has already been answered:
I have a function. This function should be called 10 times, each time after 10 seconds. I tried to do it like this, but it displays only once:
for (var i = 0; i <=10; i++) { setTimeout(funcBefore, 1000); } This question has already been answered:
I have a function. This function should be called 10 times, each time after 10 seconds. I tried to do it like this, but it displays only once:
for (var i = 0; i <=10; i++) { setTimeout(funcBefore, 1000); } A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .
Alternate, shows iteration 10 times every 10 seconds
function funcBefore(){ console.log('text'); } count = 0; intervalId = setInterval(function(){ count++; if(count == 10){ clearInterval(intervalId); } funcBefore(); }, 1000); After 10 seconds, a cycle of 10 iterations starts with a function call
function funcBefore (i) { console.log(i); } setTimeout(function() { for (var i = 0; i < 10; i++) { funcBefore(i); } }, 10000); function funcBefore() { console.log("funcBefore"); } setTimeout( function() { for (var i = 0; i <= 10; i++) funcBefore(); }, 10000 ); funcBefore line - Anton ShchyrovSource: https://ru.stackoverflow.com/questions/592702/
All Articles