Aliendreamer

example for sleep in a loop for js without loop

Nov 11th, 2019
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function testSetTimeOut(count){
  2.     let innerCount =3;
  3.  
  4.         setTimeout(function(){
  5.             console.log(Math.floor(Date.now()/1000));
  6.             console.log(count);
  7.             count++;
  8.             if(count<3){
  9.                 testSetTimeOut(count);
  10.             }
  11.         },5000)
  12.  
  13.     }
  14.  
  15. testSetTimeOut(0)
Advertisement
Add Comment
Please, Sign In to add comment