title: How does Deferred pass values?
body: <p>Can anyone explain me how the <code>deffered</code> part works in this code?.</p>
  
  <pre><code>(function() {
  
   var getPosition = function (options) {
      var deferred = $.Deferred();    
      navigator.geolocation.getCurrentPosition(
          deferred.resolve,
          deferred.reject,
          options);    
      return deferred.promise();
   };
  
   var lookupCountry = function (position) {
      var deferred = $.Deferred();    
      var latlng = new google.maps.LatLng(
                          position.coords.latitude,
                          position.coords.longitude);
      var geoCoder = new google.maps.Geocoder();
      geoCoder.geocode({ location: latlng }, deferred.resolve);    
      return deferred.promise();
   };
  
   var displayResults = function (results, status) {            
      $("body").append("&lt;div&gt;").text(results[0].formatted_address);      
   };
  
   $(function () {
      $.when(getPosition())
       .pipe(lookupCountry)
       .then(displayResults);
   });    
  }());
  </code></pre>
  
  <p>I have a couple of questions on how the above code works..</p>
  
  <pre><code>$(function () {
      $.when(getPosition())
       .pipe(lookupCountry)
       .then(displayResults);
  });
  </code></pre>
  
  <ol>
  <li>How does the above code without passing <code>options</code> still work?. </li>
  <li>What does the <code>pipe</code> method do and how is the <code>position</code> passed to lookupCountry() method?.</li>
  <li>What will happen if <code>deferred.reject</code> is being triggered in <code>getPosition</code> function?</li>
  </ol>