← Back to blog

Promise Methods In Javascript

In this article, we are going to learn about JavaScript Promise methods. Why only methods ? 🤔 Because in this cruel world, everyone can make a promise, but no one really knows how to keep a promise.

March 17, 2026

In this article, we are going to learn about JavaScript Promise methods. Why only methods ? 🤔

Because in this cruel world, everyone can make a promise, but no one really knows how to keep a promise. So I'm on a mission to make this world a better place by teaching you not just how to make a promise, but how to actually keep it.😌🤝

So let's get started. But before we jump into Promise methods, I want to explain about- what is a Promise?

Just in case some nerd opens this article who doesn't even know how to make one Promise but is trying to learn the methods. Kind of like me trying to build a full-stack app right after learning HTML.

What is a JavaScript Promise ?

A Promise in JavaScript is an object that represents the eventual completion or failure of an asynchronous task.

As we all know Javascript is a single-threaded and synchronous language, So it can only handle one task at a time - and that to be a synchronous task.

So now what JavaScript will do when he have to do some async task ?

Let's take an example from a Bollywood movie.

You have seen this many times - the hero finds his soulmate and wants to marry her.

But he can't just do it. Why? Because first of all, this is India, not Los Angeles.

Our hero needs to convince the religious + strict + stereotype father of that girl. And he can only marry her when the father gives the green signal. But trust me my friend this is not easy as it sounds.

For now, let's say the hero is "RAJ" and the heroine is "SIMRAN"

And just like our movie, JavaScript works in a similar way. When it needs to handle any async task, it makes a Promise. Now that Promise has 3 states.

Anything can happen. You never know if the strict father will agree or not. In the same way, you never know whether the Promise will resolve or reject.

Three states of a Promise :

1- Pending

2- Fulfilled**

3- Rejected**

Let's deep dive into what does these states even mean …..

  • When promise is pending - RAJ promises to win SIMRAN & He goes to convince her strict father. ( Now RAJ is on his way not reached yet …… still in the train…….) 🏃‍♀️🚂

  • When promise is fulfilled - RAJ finally convinced SIMRAN'S father's approval. Now RAJ & SIMRAN can live happily ever after:)🧎‍➡️🧍‍♀️

  • When promise is rejected - RAJ failed to convince SIMRAN'S strict father and SIMRAN married someone else. :( 🧍‍♀️🚂💃

So I hope now you have a better understanding of JavaScript Promises.

And if you are not an Indian, then I assume I just gave you an insider tip on how to make your own Bollywood movie.


Now it's time for the main thing. Are you all excited !!!

Let's start discussing about Promise Methods in Javascript.

Promise Methods in JavaScript

So in JavaScript Promise we have mainly 2 types of methods -

Instance Method

  • promise.then()

  • promise.catch()

  • promise.finally()

Static Method

  • Promise.all()

  • Promise.allSettled()

  • Promise.race()

  • Promise.any()

  • Promise.resolve()

  • Promise.reject()

Let's start with Instance Methods. But alwys remember one thing before all these one thing has already happened - which is promise creation.

RAJ already promised SIMRAN:

"Simran, I will win your father's approval and come back for you."

promise.then()

This method runs when a promise is fulfilled. Which means Happy Ending of our story. Promise is resolved. RAJ finally wins the heart of SIMRAN's strict father.

.then() executes when :

  • Promise is fulfilled

  • It receives the resolved value.

let rajPromise = new Promise((resolve, reject) => {
    let fatherAgrees = true;

if (fatherAgrees) {
        resolve("Simran mil gayi ❤️");
    } else {
        reject("Bauji ne mana kar diya 💔");
    }
});

rajPromise.then((result) => {
    console.log("Success:", result);
});

Now if resolved - .then() runs and we get "Simran mil gayi ❤️ " as result.

If rejected - .then() is skipped.

The interesting thing here is You can always chain .then() and Each .then() returns a new promise. promise

promise
  .then((res) => {
    console.log(res);
    return "Cold drink";
  })
  .then((drink) => {
    console.log(drink);
  });

Promise chaining is like -

  • RAJ wins father

  • Then marry SIMRAN

  • Then they live happily …..

promise.catch()

This method runs when the promise is rejected.

When SIMRAN'S father says - "Mat ja SIMRAN".

Now the Promise that RAJ made to SIMRAN is rejected. Raj fails & Love story breaks.

let rajPromise = new Promise((resolve, reject) => {
    let fatherAgrees = false;

if (fatherAgrees) {
        resolve("Simran mil gayi ❤️");
    } else {
        reject("Bauji ne mana kar diya 💔");
    }
});

rajPromise.then((result) => {
    console.log("Success:", result);
}).catch((error) => {
      console.log("Error:", error);
  });

Now as we can see the fatherAgrees is false , so now the .catch() method will work here and we will get error as - "Bauji ne mana kar diya 💔"

promise.finally()

This method runs no matter what happens. It will run whether promise resolved or rejected.

This method is like the TRAIN that leaves anyway.

If RAJ gets SIMRAN or not . The TRAIN will not stop for anyone, it will leave the station.

rajPromise
  .then((result) => {
      console.log("Success:", result);
  })
  .catch((error) => {
      console.log("Error:", error);
  })
  .finally(() => {
      console.log("Train has left the station 🚂");
  });

Unlike .then() and .catch() , .finally() doesn't receives any value. It is mainly used for cleanup tasks.


Now as we have completed learning about Instance Methods , now let's start our Static Methods.

Promise.resolve()

Imagine SIMRAN'S Father immediately says: "Ja SIMRAN, Jee le apni zindagi".

Now there is no struggle.

No delay. Already Successful.

This is exactly how Promise.resolve() works.

It creates a promise that is already fulfilled. let p = Promise.resolve("Simran mil gayi ❤️");

let p = Promise.resolve("Simran mil gayi ❤️");

p.then(data => console.log(data)); 

Use When:

  • You want to return a resolved promise

  • Convert normal value into promise

Promise.reject()

Now SIMRAN'S Father says : "Bilkul nahi"

Which means her father denied. Now there is No more chance for RAJ to marry SIMRAN. Direct Failure.

And this is how Promise.reject() works. Already rejected promise.

let p = Promise.reject("Shaadi cancel 💔");

p.catch(err => console.log(err));

You can use this when you want to manually trigger failure.

Promise.all()

Now RAJ must complete All tasks:

  • Convince SIMRAN's father

  • Impress SIMRAN's mon

  • Fight with Villains

Now if ANY ONE fails - then RAJ & SIMRAN can't be together.

Only when ALL SUCCEED - then weeding happens.

And this is how exactly Promise.all() works.

let bauji = Promise.resolve("Bauji agreed");
let mom = Promise.resolve("Mom agreed");
let goons = Promise.resolve("Villains defeated");

Promise.all([bauji, mom, goons])
  .then(results => {
    console.log("Shaadi pakki:", results);
  })
  .catch(err => {
    console.log("Mission failed:", err);
  });
  • If ONE rejects - whole thing rejects.

  • This method returns array of results.

Promise.allSettled()

Now it is like RAJ wants to know :

  • Who aggred

  • Who rejected

Even if someone says no, he still wants to know all outcomes.

And this is how Promise.allSettled() method works.

Marriage may or may not happen - but we get full report of who aggred and who disagree. (So we can deal with them later 😈)

let bauji = Promise.resolve("Bauji agreed"); let mom = Promise.resolve("Mom agreed"); let fufaJi = Promise.reject("FufaJi said no");

let bauji = Promise.resolve("Bauji agreed");
let mom = Promise.resolve("Mom agreed");
let fufaJi = Promise.reject("FufaJi said no");

Promise.allSettled([bauji, mom, fufaJi])
  .then(results => {
    console.log(results);
  });

Output looks like :

[
  { status: "fulfilled", value: "Bauji agreed" },
  { status: "fulfilled", value: "Mom agreed" },
  { status: "rejected", reason: "fufaJi said no!" },
]

This method never rejects.

Always gives status of all promises.

Promise.race()

RAJ is running to catch the train & SIMRAN is waiting.

Whoever happens FIRST decides the FATE.

  • If RAJ reaches the train first - love wins

  • If TRAIN leaves the station first - love lost

And this is how Promise.race() works.

First settled promise always wins. No matter it is resolved or rejected.

let raj = new Promise(resolve =>
  setTimeout(() => resolve("Raj reached train"), 2000)
);

let train = new Promise(( reject) =>
  setTimeout(() => reject("Train left 💔"), 1000)
);

Promise.race([raj, train])
  .then(res => console.log(res))
  .catch(err => console.log(err));

Promise.any()

RAJ tries to :

  • Convince SIMRAN's father

  • Convince SIMRAN's mom

  • Convince SIMRAN's fufaJi

Now situation got out to control. RAJ just need at least one persons approval to their relationship. IF any one of these aggrees then RAJ and SIMRAN can live happily. They just need one validation now.

And this is how Promise.any() works.

let p1 = Promise.reject("Bauji no");
let p2 = Promise.reject("Mom no");
let p3 = Promise.resolve("fufaJi helped");

Promise.any([p1, p2, p3])
  .then(res => console.log("Hope alive:", res))
  .catch(err => console.log("All rejected:", err));

This method resolves when FIRST fulfilled promise comes.

This method rejects only when all are rejected.

Summary

At the end of the day, a Promise in JavaScript is simple - handle it properly, and it won't break your app… or your heart. I tried my best to keep the Hindi minimal so this article stays accessible to everyone . I hope you enjoyed the story.

#chaicode #javascript #promise