title: Is it possible to return a value from setTimeout without a callback function?
body: <p>Long story short, is it possible to do something like this without a callback function?</p>
  
  <pre><code>function foo(){
    return 'foo';
  }
  function bar(){
    x = setTimeout(foo, 2000);
    alert(x);
  }
  </code></pre>
  
  <p>Without modifying the foo() function. Adding an intermediary function would be fine, but I don't think that'll accomplish anything.</p>
  
  <p>Long story:
  I'm looking to simulate window.showModalDialog via window.open without having to do significant code rewrites everywhere the dang thing was used. The only suggestions I have found are to use a while loop or ping the server to simulate sleep(). Neither solution strikes me as ideal, and I am wondering if there is any other way to do something like this minus the callback function method?</p>