Last active
October 4, 2015 05:34
-
-
Save davismj/c09e8c3ddd8c9864941d to your computer and use it in GitHub Desktop.
Demonstration of ES2016 await keyword
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
var val = await new Promise((res, rej) => { | |
res('something') | |
}); | |
// val === 'something' | |
// this is equivalent to | |
var val; | |
new Promise((res, rej) => { | |
res('something'); | |
}).then((value) => { | |
val = value; | |
// val === 'something' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment