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 | dns.resolve() Method
- Node.js | dnsPromises.resolve() Method
- How to wait for a promise to finish before returning the variable of a function?
- Node | URL.resolve(from,to) API
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.