DEV Community

Rishi Dadheech
Rishi Dadheech

Posted on

JavaScript Promises

It's a quick guide to write a function that returns promise and how to consume it.

  1. How to write a function that returns promise.

Alt Text

Now there are two ways to consume the returned promise.
A. using then-catch
B. using async-await

A. using then-catch

Alt Text

B. using async-await

Alt Text

Top comments (0)