Y
Hacker News
new
|
ask
|
show
|
jobs
by
eloff
1889 days ago
That's not true if you just return the promise instead of using return await, right?
1 comments
junon
1888 days ago
No. `async` on a function automatically defers it even if the return value is immediate.
> async function foo() { return "hello"; } foo().then(console.log); console.log("after")
after hello
link
> async function foo() { return "hello"; } foo().then(console.log); console.log("after")
after hello