DEV Community

Karthikeyan
Karthikeyan

Posted on

One Byte Explainer - Promise

Hello 👋

Let's start with Promise

One-Byte Explainer:

Promises are like a waiter taking your order. They handle results which can be either success or failure.

Demystifying JS: Promise in Action

  1. Place the Order: You give your order to the waiter (Promise).

  2. Waiter Takes Order: The waiter takes your order (async task begins).

  3. Continue Waiting: While waiting for the order (promise results), you can do other things (program continues to run).

  4. Food Arrives (or Not): The waiter brings your food (success) or tells you there's an issue (error).

  5. React to Result: Based on the result, if success, you enjoy the food; if error, you order something else.

Thank you for reading , See you in the next blog

final

Top comments (0)