DEV Community

Cover image for Promise vs Callback
Shashi Bhushan Kumar
Shashi Bhushan Kumar

Posted on

Promise vs Callback

When learning JavaScript, many beginners get confused between Callback and Promise.
Here is a very simple way to understand the difference.

Real-life example

Imagine you ask a friend:

Callback way

“Call me after you reach home.”

Here:

  • Your friend must remember to call you
  • If there are many tasks, the call can be forgotten
  • Things become confusing when steps increase

This is similar to callbacks.
You pass a function and wait for it to be called later.

Promise way

“I promise I will call you when I reach home.”

Now the situation is clear:

  • Either you get the call (success)
  • Or you are told why it didn’t happen (failure)

There is no confusion.

This is how Promises work.

JavaScript meaning (simple)

  • Callback

    • A function passed to another function
    • Harder to manage when there are many steps
  • Promise

    • Represents a future result
    • Has a clear outcome:
    • resolve (success)
    • reject (failure)

Why Promises are better

  • Code is easier to read
  • Errors are easier to handle
  • Less confusion when tasks increase

One-line summary

Callbacks work, but Promises make async code easier to understand and manage.

Next Question

What is Callback Hell, and why is it considered a problem in JavaScript?

Top comments (0)