Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement