A JavaScript async function always returns a new promise, even if you immediately return a promise.
Experimental Setup
|
|
Experiments
Confirm that a new promise is always generated by an async function
|
|
|
|
Examine the behavior of the resolve function passed to executor function of a new promise
|
|
|
|
Take Away
Working with an async function is equivalent to working within the executor of a new promise.
The resolve function, the first argument of the promise executor, behaves the same as the return statement of an async
function.
|
|