title: syntax for Jquery.deferred , making synchronous function return promise
body: <p>A quick question on how to use Jquery.deferred to make a slow synchronous function return a promise instead.
  What I've done so far is this :</p>
  
  <pre><code>function sayIt(ms) {
      setTimeout( function() { console.log('what I say'); }, ms);
  } 
  
  function doIt() {
      return $.Deferred( function() { sayIt(2000); }).promise();
  }
  
  
  doIt().then( function() { console.log('ah'); });
  </code></pre>
  
  <p>the sayIt(2000) always goes through but the chained function after the 'then' never fires. </p>
  
  <p>If I do this :</p>
  
  <pre><code>doIt().then( console.log('ah'));
  </code></pre>
  
  <p>the 'ah' comes up right away, and then the 'what I say' 2000ms later - what I want is of course the opposite - that after two seconds I get 'what I say' and then 'ah' right after.</p>
  
  <p>Any suggestions appreciated!</p>