Visit complete Node.js roadmap
Node.js Topic

Promises

Promises

A promise is commonly defined as a proxy for a value that will eventually become available Asynchronous functions use promise behind the scenes, so understanding how promises work is fundamental to understanding how “async” and “await” works. Once a promise has been called, it will start in a pending state. This means that the calling function continues executing, while the promise is pending until it resolves, giving the calling function whatever data was being requested.

Creating a Promise: The Promise API exposes a Promise constructor, which you initialize using newPromise().

Using resolve() and reject(), we can communicate back to the caller what the resulting Promise state was, and what to do with it.

Visit the following resources to learn more:

More Topics

Explore related content

View All Topics
Loved by 100K+ Developers

Start Your Learning
Journey Today

Join thousands of developers who are leveling up their skills with structured roadmaps and expert guidance

No credit card required
Always free
Track your progress