Created
May 14, 2018 11:55
-
-
Save valsaven/7b0a3c7afb76c9635c3118a2537c8f60 to your computer and use it in GitHub Desktop.
Async/Await Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
let one = new Promise((resolve, reject) => { | |
let wait = setTimeout(() => { | |
resolve('ONE'); | |
}, 1000); | |
}); | |
let two = new Promise((resolve, reject) => { | |
let wait = setTimeout(() => { | |
resolve('TWO'); | |
}, 100); | |
}); | |
console.log(await one); | |
console.log(await two); | |
})(); | |
console.log('Finished'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment