Skip to content

Instantly share code, notes, and snippets.

@octopuss
Created November 3, 2016 21:39
Show Gist options
  • Save octopuss/697a8c839a254559045cd41a65978e74 to your computer and use it in GitHub Desktop.
Save octopuss/697a8c839a254559045cd41a65978e74 to your computer and use it in GitHub Desktop.
Promises alternative to async await http://www.es6fiddle.net/iv2vj8jm/
console.log("First");
var p = new Promise((ok, reject) => {
try {
console.log("Second");
ok();
} catch (err) {
reject();
}
});
p.then(() => {console.log("Fourth")})
console.log("Third");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment