Skip to main content

Command Palette

Search for a command to run...

Promise.resolve vs new Promise: When Should You Use What?

Updated
2 min read
Promise.resolve vs new Promise: When Should You Use What?
S

I'm Shubham (@shubhamsinghbundela), I'm a Software Engineer, a Full-stack developer, a tech enthusiast, and a technical writer here on @Hashnode. I have a strong zeal to share my acquired knowledge and I am also willing to learn from others.

Most developers get stuck comparing Promise.resolve and new Promise, trying to understand the difference.


Why This Confusion Happens

In simple cases, both approaches behave the same:

Promise.resolve("Hello");

new Promise((resolve) => resolve("Hello"));
  • Both return a resolved Promise

  • Both can be used with .then() or await


Rule of Thumb

  • Use Promise.resolve when you already have the result

  • Use new Promise when you need to create async behavior

That’s it. Now let’s expand with real examples.


When to Use Promise.resolve

1. When You Already Have a Value

function getData() {
  return Promise.resolve(42);
}
  • You’re not doing anything async

  • Just wrapping a value in a Promise


When to Use new Promise

1. When You Need Async Control (Most Important)

function delay(ms) {
  return new Promise((resolve) => {
    setTimeout(resolve, ms);
  });
}

You decide when to resolve


Quick Comparison (Use Case Based)

Situation What to Use
Already have value Promise.resolve
Just wrapping result Promise.resolve
Need delay / timer new Promise
API / callback conversion new Promise
Need manual resolve/reject new Promise

More from this blog

Shubham Tech. Blog's

55 posts

Problem Solver | Currently Working As a Full Stack Developer, Community Leader At @Dev_Matrix | Previously Contributor at @RealDevSquad, @TeamShiksha