1.

What are the states of Promises in ES6?

Answer»

Promises mainly possess three states as follows:

  • Pending: This refers to the initial state of every promise. It INDICATES that the result has not yet been computed.
  • Fulfilled: It refers to the completion of a task.
  • Rejected: It indicates the failure that ARISES during computation.

The promise will be immutable once it has been fulfilled or rejected. A rejected FUNCTION and a resolve function are the two arguments passed into the Promise() constructor. It returns either the first or second parameter, DEPENDING on the asynchronous OPERATION.



Discussion

No Comment Found