Reputation: 901
I know about code after resolve will be executed; I'm not talking about that.
My question is about returning a resolve
object like:
return resolve(err)
Is it different from returning nothing? Like:
resolve(err)
return
which is like
...
resolve(err)
}
I'm talking about the canonical case where the promise is handled with then and catch like:
functionReturningAPromise().then().catch()
Upvotes: 0
Views: 156
Reputation: 6884
The statement
return resolve(err);
doesn't make much sense and could be confusing. resolve
doesn't explicitly return anything. The only reason to use
return resolve(err);
is to shorten
resolve(err);
return;
That means that
return resolve(err);
and
resolve(err);
return;
are equivalent.
Upvotes: 3