References

Beginner-friendly references for web development, with live, editable examples.

The JavaScript Promise.resolve() method

Method JavaScript All modern browsers Updated
Quick answer

The Promise.resolve(value) method returns a promise that is already fulfilled with value. It's used to wrap a plain value in a promise, to start a promise chain, or to normalize a function that might return either a value or a promise. Its counterpart is Promise.reject(reason).

Overview

Promise.resolve() creates a promise that's already settled in the fulfilled state, carrying whatever value you pass. It's a small utility with a few handy uses: wrapping a non-promise value so it can be used in promise-based code, providing an already-resolved starting point for a .then() chain, and returning a quick resolved promise from a function for consistency or in tests.

A common real use is normalizing a value that might be either a plain value or a promise. Promise.resolve(maybePromise) returns the promise unchanged if it already is one, or wraps a plain value — so downstream code can always await it without checking. (Note that async functions do this wrapping automatically, which is why you reach for Promise.resolve() less often than you might expect.)

Its mirror is Promise.reject(reason), which returns an already-rejected promise — useful for early-exit error cases in a promise-returning function. Both are mostly building blocks; in everyday code, async/await handles most of what they were once needed for.

Syntax

Promise.resolve(value)

Promise.resolve(42).then(v => console.log(v));  // 42
Promise.resolve(existingPromise);   // returned as-is
Promise.reject(new Error("no"));    // already-rejected

Parameters

The Promise.resolve() method accepts the following parameters.

Parameter Description
value The value to fulfill the promise with. If it is already a promise, it is returned unchanged.

Example

Live example
<pre id="out" style="font:15px ui-monospace,monospace"></pre>
<script>
  // normalize a value that might be a promise or not
  function load(input) {
    return Promise.resolve(input).then(v => 'loaded: ' + v);
  }

  Promise.all([load(42), load(Promise.resolve('async'))]).then(results => {
    document.getElementById('out').textContent = results.join('\n');
  });
  // loaded: 42 / loaded: async
</script>

Best practices

  • Use it to wrap a plain value in a promise, or to start a .then() chain.
  • Use it to normalize "value or promise" so callers can always await the result.
  • Use Promise.reject(reason) for an already-rejected promise (early error exits).
  • Remember async functions auto-wrap return values, so you often don't need it.

Frequently asked questions

What does Promise.resolve() do?
It returns a promise that's already fulfilled with the value you pass.
When would I use Promise.resolve()?
To wrap a value in a promise, start a chain, or normalize a function that may return a value or a promise so it can always be awaited.
What is Promise.reject()?
The opposite — it returns an already-rejected promise with the given reason, handy for early error exits.
Do I need Promise.resolve() with async/await?
Usually not — async functions automatically wrap returned values in resolved promises.