-
-
Save drgullin/dea91c41539a28c6121e0d82a96dad14 to your computer and use it in GitHub Desktop.
Interleaving of await and promises
This file contains 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
async function pr(v) { console.log("pr(" + v + ")"); } | |
async function f() { for (var i = 0; i < 10; i++) { await pr(i); } return 0; } | |
function ct(v) { console.log("counter" + v); if (v > 0) Promise.resolve(v - 1).then(ct); } | |
ct(10); f(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment