javascript - When would someone need to create a deferred? -
it seems creating deferred objects commonly discouraged in favor of using es6-style promise constructor. there exist situation necessary (or better somehow) use deferred? for example, on this page , following example given justification using deferred: function delay(ms) { var deferred = promise.pending(); settimeout(function(){ deferred.resolve(); }, ms); return deferred.promise; } however, done promise constructor: function delay(ms) { return new promise(function(resolve, reject){ settimeout(function(){ resolve(); }, ms); }); } does there exist situation necessary (or better somehow) use deferred? there no such situation deferred necessary. "better" matter of opinion won't address here. there's reason es6 promise specification not have deferred object. you don't need one. people used use deferred object can always done way doesn't use deferred object. first of...