Created
March 29, 2019 13:40
-
-
Save hajipy/280d22320c598f2667235b9ec7df0e24 to your computer and use it in GitHub Desktop.
Nested Promise
This file contains 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
// Promise chain Style | |
const aPromise = Promise.resolve(1).then(result => Promise.resolve(result)); | |
// Promise.then Style | |
// const aPromise = new Promise((resolve) => Promise.resolve(1).then((result) => resolve(result))); | |
// async/await Style | |
// const aPromise = new Promise(async (resolve) => resolve(await Promise.resolve(1))); | |
aPromise.then( | |
(result) => console.log(result) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment