SHARE
TWEET

Untitled

a guest Oct 15th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const wait = (millisecondsToWait) => new Promise((resolve) => {
  2.   setTimeout(resolve, millisecondsToWait);
  3. });
  4.  
  5. wait(1000).then(() => {
  6.   console.log("First promise");
  7.   return wait(2000);
  8. }).then(() => {
  9.   console.log("Second promise");
  10.   return wait(2500);
  11. }).then(() => {
  12.   console.log("Third promise");
  13.   return wait(3000);
  14. });
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