Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
Is there a difference between `resolve` then `return` and `return resolve()`

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()
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!