What is a Promise in JavaScript?

Ravi Ranjan Jaiswal
Ravi Ranjan Jaiswal

Posted On: Feb 22, 2018

 

An object that is able to produce a single value sometime in the future is known as Promise. The single value may either be a resolved value, or it can be a reason that it’s not resolved. There can be three states in which Promise can be:

  • Fulfilled
  • Reject
  • Pending

There can be callbacks that can be attached to handle the fulfilled value or the rejection’s reason, this can be done by the Promise users.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    JavaScript Closure Interview Questions

    What is closure in JavaScript and why is it useful?

    A closure in JavaScript is known as JavaScript closure. It makes it possible for a function to have "private" variables. JavaScript closure is used to control what is and isn't in scope in a particula...

    JavaScript Closure Interview Questions

    Enlist list advantages of closures in JavaScript?

    There are several advantages of using closures in JavaScript. Some of them are:Closure enables the use of nested functions that are used to get the values created in the execution context of that ...

    JavaScript Closure Interview Questions

    What is difference between Closure and scope?

    Whenever you create a function within another function, then the inner function is closure. This closure is usually returned so you can use the outer function’s variables at a later time. Wherea...