From 29ab97e2787a25b3016ce71742e1d48233e1ebcc Mon Sep 17 00:00:00 2001 From: zjlovezj Date: Fri, 21 Jul 2023 17:01:19 +0800 Subject: [PATCH] Update Promise reference: Promise.resolve description (#28096) Promise.resolve() doesn't always return a new Promise. For example, Promise.resolve(alreadyAPromise) will return alreadyAPromise. --- .../web/javascript/reference/global_objects/promise/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/javascript/reference/global_objects/promise/index.md b/files/en-us/web/javascript/reference/global_objects/promise/index.md index 517704c6e3bd940..a0cd5686e790bef 100644 --- a/files/en-us/web/javascript/reference/global_objects/promise/index.md +++ b/files/en-us/web/javascript/reference/global_objects/promise/index.md @@ -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.