3 ms·
JS does - just wrap all your code in an async function, and then you can await within. > async function run() { // call your program logic here await
by Blahah 5y ago
JS does - just wrap all your code in an async function, and then you can await within.
> async function run() {
// call your program logic here
await myCode()
}
> run()
- cuteboy19 5y agoBut this approach would async-pollute all the sync calling functions right? if I had a call tree like function A(){ B()} function B(){ C()} ... function Y(){ await? Z()} async function Z(){...} Then A-Y would need to become async. If await Z() was allowed then we could avoid this. So is there a reason why it could not be implemented this way?