SHARE
TWEET

Untitled

a guest Mar 24th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async function f5() {
  2.     let promise = new Promise((resolve, reject) => {
  3.         setTimeout(() => resolve("done!"), 5000)
  4.     });
  5.     let result = await promise; // wait till the promise resolves (*)
  6.     console.log('Demorou 5 secs'); // "done!"
  7. }
  8. async function f1() {
  9.     let promise = new Promise((resolve, reject) => {
  10.         setTimeout(() => resolve("done!"), 1000)
  11.     });
  12.     let result = await promise; // wait till the promise resolves (*)
  13.     console.log('Demorou 1 secs'); // "done!"
  14. }
  15. async function f10() {
  16.     let promise = new Promise((resolve, reject) => {
  17.         setTimeout(() => resolve("done!"), 10000)
  18.     });
  19.     let result = await promise; // wait till the promise resolves (*)
  20.     console.log('Demorou 10 secs'); // "done!"
  21. }
  22.  
  23. f10()
  24. f1()
  25. f5()
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