Skip to content

Commit

Permalink
Update Promise reference: Promise.resolve description (#28096)
Browse files Browse the repository at this point in the history
Promise.resolve() doesn't always return a new Promise.
For example, Promise.resolve(alreadyAPromise) will return alreadyAPromise.
  • Loading branch information
zjlovezj authored Jul 21, 2023
1 parent caf8a35 commit 29ab97e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Note that JavaScript is [single-threaded](/en-US/docs/Glossary/Thread) by nature
- : Returns a new `Promise` object that is rejected with the given reason.
- {{jsxref("Promise.resolve()")}}

- : Returns a new `Promise` object that is resolved with the given value. If the value is a thenable (i.e. has a `then` method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise, the returned promise will be fulfilled with the value.
- : Returns a `Promise` object that is resolved with the given value. If the value is a thenable (i.e. has a `then` method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise, the returned promise will be fulfilled with the value.

Generally, if you don't know if a value is a promise or not, {{jsxref("Promise.resolve", "Promise.resolve(value)")}} it instead and work with the return value as a promise.

Expand Down

0 comments on commit 29ab97e

Please sign in to comment.