Created
August 12, 2019 03:24
-
-
Save BetterProgramming/7463a923f56c8e966a9ddf8f282f4e05 to your computer and use it in GitHub Desktop.
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
var concurrent = async function() { | |
startTime = performance.now(); | |
const resolveAfter3seconds = promiseTRSANSG(3); | |
console.log("Promise for resolveAfter3seconds created at ", executingAt()); | |
const resolveAfter4seconds = promiseTRSANSG(4); | |
console.log("Promise for resolveAfter4seconds created at ", executingAt()); | |
resolveAfter3seconds.then(function(){ | |
console.log("resolveAfter3seconds resolved at ", executingAt()); | |
}); | |
resolveAfter4seconds.then(function(){ | |
console.log("resolveAfter4seconds resolved at ", executingAt()); | |
}); | |
console.log(await resolveAfter4seconds); | |
console.log("await resolveAfter4seconds executed at ", executingAt()); | |
console.log(await resolveAfter3seconds); | |
console.log("await resolveAfter3seconds executed at ", executingAt()); | |
}; | |
concurrent(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment