title: javascript setTimeout() outputs save as variables
body: <p>I want to save setTimeout()  outputs as variables.</p>
  
  <p>for example: </p>
  
  <pre><code>function time() {
   return  (new Date).getTime();
   }
  
  for (var x=0; x&lt;10; x++) {
     setTimeout( time() , 2000);
  }
  </code></pre>
  
  <p>the above javascript code returns  time in milliseconds every 2 seconds upto 10 times.</p>
  
  <p>So we'll get 10 outputs. I want to save those outputs as 10 variables. So i'll be able to calculate  average etc.</p>
  
  <p>Please any help will be appreciated.</p>