Created
June 26, 2018 17:55
-
-
Save vkarpov15/35f1ba08eec70963865bddaad9336082 to your computer and use it in GitHub Desktop.
Async example
This file contains hidden or 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
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