Guest User

Untitled

a guest
Dec 10th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. function sleep(ms) {
  2. return new Promise(resolve => setTimeout(resolve, ms));
  3. }
  4.  
  5. async function test() {
  6.  
  7. for (let i=1; i<=10; i++) {
  8. console.log('Taking a break...' + i);
  9. await sleep(1000);
  10. console.log('done');
  11. }
  12.  
  13. }
  14.  
  15. test();
Add Comment
Please, Sign In to add comment