Newer asynchronous functions in JavaScript are designed to return a promise instead of taking a callback.

Definition: A promise is an object through which a function may propagate an error or result sometime in the future.

States

At any time, a promise is in one of three states:

  1. Pending
  2. Resolved
  3. Rejected

Get hands-on with 1400+ tech skills courses.