Standard built-ins
Promise.resolve()
Returns a promise resolved to the value, adopting thenables. For an existing promise with the matching constructor, the method returns that promise unchanged.
Formal Syntax & Structure
javascript syntaxjavascript
Promise.resolve(value)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | any | Value or thenable to resolve. |
Return Value
Promise
Promise resolved to the value.
Working Example
Example Snippetjavascript
const p=Promise.resolve(4); console.log(Promise.resolve(p)===p); p.then(console.log);