Skip to content

Instantly share code, notes, and snippets.

@davismj
Last active October 4, 2015 05:34
Show Gist options
  • Save davismj/c09e8c3ddd8c9864941d to your computer and use it in GitHub Desktop.
Save davismj/c09e8c3ddd8c9864941d to your computer and use it in GitHub Desktop.
Demonstration of ES2016 await keyword
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