daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Feb 12th, 2019 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const waitFor = (ms) => new Promise(r => setTimeout(r, ms));
  2.  
  3. start = async () => {
  4.   try {
  5.     console.log("start");
  6.     c = 1;
  7.     while(c < 10){
  8.       await waitFor(2000)
  9.       console.log('waiting!');
  10.       if(c === 3){
  11.         console.log('errrorr!!')
  12.         throw new Error('dasdas');
  13.       }
  14.       c++
  15.     }
  16.     console.log('end');
  17.   } catch (error) {
  18.     console.log('catched!!!');
  19.   }
  20.  
  21. }
  22.  
  23. start();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top