Answers for "javascript make wait in loop"

6

wait for time javascript

//code before the pause
setTimeout(function(){
    //do what you need here
}, 2000);
Posted by: Guest on November-28-2019
0

wait for 1 second in loop in javascript

(function myLoop(i) {
  setTimeout(function() {
    console.log('hello'); //  your code here                
    if (--i) myLoop(i);   //  decrement i and call myLoop again if i > 0
  }, 3000)
})(10);                   //  pass the number of iterations as an argument
 Run code snippet
Posted by: Guest on January-25-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language