; + name + &#39; is not allowed.&#39;);
    }
  }, 1000);

  return deferred.promise;
}

var promise = asyncGreet(&#39;Robin Hood&#39;);
promise.then(function(greeting) {
  alert(&#39;Success: &#39; + greeting);
}, function(reason) {
  alert(&#39;Failed: &#39; + reason);
}, function(update) {
  alert(&#39;Got notification: &#39; + update);
});
</code></pre>
<p>At first it might not be obvious why this extra complexity is worth the trouble. The payoff
comes in the way of guarantees that promise and deferred 