Reputation: 21
Sorry if its a really naive question. I have described the situation as follows. My question is, will OtherAsyncFunction()
continue and complete its execution if runThis()
returns prematurely?
var a = await runThis();
async function runThis(){
// ...
OtherAsyncFunction();
// ...
return await someOtherAsyncFunction;
}
Upvotes: 1
Views: 60
Reputation: 2114
It will still execute OtherAsyncFunction
, unless you do await OtherAsyncFunction()
.
An async function can contain an await expression that pauses the execution of the async function and waits for the passed Promise's resolution, and then resumes the async function's execution and returns the resolved value. See more details here
Upvotes: 3