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

JavascriptFront End TechnologyObject Oriented Programming

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.

raja
Published on 02-Dec-2019 05:31:12
Advertisements