title: Function return a list of values that could only be get asynchronously
body: <p>I'd like to write this function:  </p>
  
  <pre><code>function getResults(nums){
      var results = [];
      for(var i = 0, len = nums.length; i &lt; len; i++){
          var num = nums[i];
          ajaxGet("http://xxx.com/" + num, function(data){
              results.push(data);
          });
      }
      return results;
  }    
  var results = getResults([12, 22, 34]);
  </code></pre>
  
  <p>as you can see, because <code>ajaxGet</code> is asynchronous, this won't work. How could I do this properly?</p>