Skip to content

Instantly share code, notes, and snippets.

@valsaven
Created May 14, 2018 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valsaven/7b0a3c7afb76c9635c3118a2537c8f60 to your computer and use it in GitHub Desktop.
Save valsaven/7b0a3c7afb76c9635c3118a2537c8f60 to your computer and use it in GitHub Desktop.
Async/Await Example
(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