|
|
|
|
|
by endorphine
1576 days ago
|
|
> Maybe this is the core of the question: for a language like JavaScript which already has an event loop, why can't we do function foo() { let x = await whatever(); return x; }
console.log(foo());
Yes, that's one of my main questions. What would happen if we did this? It's my understanding now, after reading a lot of answers (yours included), that in JS land this would result in a deadlock, because the event loop would be waiting for something (whatever()) that would itself be waiting for something else. |
|