SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const f = (wait_count, string) => (
  2.   new Promise((res, rej) => (setTimeout(() => res(string), wait_count)))
  3. );
  4.  
  5. async function sequence() {
  6.   const a = await Promise.all([
  7.     f(2000, '2000 wait'),
  8.     f(500, '500 wait'),
  9.     f(1000, '1000 wait')
  10.   ]);
  11.  
  12.   console.log(a);
  13. }
  14. sequence()
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