How to tell if a promise is resolved? [duplicate]

The ES6 Promise constructor does not have a property that can tell you the state of the promise. You need to do something like this:

import p from './promise.js'
var isResolved = false;
p.then(function() {
  isResolved = true;

// ... At some point in the future.
console.log('p is resolved?', isResolved);

There is an internal property called PromiseState but you can’t access it. Here is the spec.

Leave a Comment