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

73
Views
Create promise which never fulfils

How can I create a promise which will never fulfil? So that for example this will never reach console.log:

const res = await NEVER_FULLFILLING_PROMISE

console.log(res)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Just call new Promise and never call the first parameter in the callback.

(async () => {
  await new Promise(() => {});
  console.log('done');
})();

Another approach that fulfills the text of your question (but probably not the intent) would be to make the Promise reject, of course.

(async () => {
  await new Promise((_, reject) => reject());
  console.log('done');
})()
  .catch(() => {});

about 4 years ago · Juan Pablo Isaza 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!