Promise resolve() method:
Promise.resolve() method in JS returns a Promise object that is resolved with a given value. Any of the three things can happend:
- If the value is a promise then promise is returned.
- If the value has a “then” attached to the promise, then the returned promise will follow that “then” to till the final state.
- The promise fulfilled with its value will be returned.
Value to be resolved by this Promise.
Either the promise of the promise fulfilled with its value is returned.
Resolving an array:
Resolving another Promise:
- How to wrap setTimeout() method in a promise ?
- Node.js | fs.promise.readdir() Method
- jQuery Deferred .promise() method
- Node.js | dns.resolve() Method
- Node.js | dnsPromises.resolve() Method
- Node.js | path.resolve() Method
- JQuery deferred.resolve() method
- How to wait for a promise to finish before returning the variable of a function?
- How to convert an existing callback to a promise in Node.js ?
- Node.js | Promise Chaining
- How to resolve unhandled exceptions in Node.js ?
- Node | URL.resolve(from,to) API
- How to resolve 'node' is not recognized as an internal or external command error after installing Node.js ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.