Created
June 13, 2018 22:42
-
-
Save MayaLekova/3b0eb851baf7e6d6d6e863e5e3562f1d 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