Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. const timeout = (ms) => new Promise(resolve => setTimeout(resolve, ms))
  2.  
  3. async function example () {
  4. console.log('test')
  5. while (true) {
  6. console.log('looping')
  7. await timeout(1000)
  8. }
  9. }
  10.  
  11. example().catch(console.error)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement