Computer >> Computer tutorials >  >> Programming >> Javascript

What are the differences between Deferreds, Promises and Futures in javascript?


Future is an old term that is same as promise.

  • A promise represents a value that is not yet known. This can better be understood as a proxy for a value not necessarily known when the promise is created.

  • A deferred represents work that is not yet finished. A deferred (which generally extends Promise) can resolve itself, while a promise might not be able to do so. This can also be thought of as a promise that'll always succeed only.

A promise is a placeholder for a result which is initially unknown while a deferred represents the computation that results in the value.