Skip to content

Instantly share code, notes, and snippets.

@vkarpov15
Created June 26, 2018 17: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 vkarpov15/35f1ba08eec70963865bddaad9336082 to your computer and use it in GitHub Desktop.
Save vkarpov15/35f1ba08eec70963865bddaad9336082 to your computer and use it in GitHub Desktop.
Async example
let i = 0;
run();
setInterval(() => console.log(i), 10);
async function run() {
++i;
await new Promise(resolve => setTimeout(resolve, 15));
++i;
await new Promise(resolve => setTimeout(resolve, 15));
process.exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment