Promise.resolve Function (Promise)

Creates a new resolved promise with a result equal to its argument.

Syntax

Promise.resolve(x)  

Parameters

x
Required. The value returned with the completed promise.

Remarks

The fulfillment handling function of the then method runs when the completed promise object is returned.

Example

var p = Promise.resolve('success');  
p.then(function(result) {  
    console.log(result);  
});  

// Output:  
// success  

Requirements

Supported in Microsoft Edge (Edge browser). Also supported in Store apps (Microsoft Edge on Windows 10). See Version Information.
Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not supported in Windows 8.1.

See Also

Promise Object