title: Delay the return of a function
body: <p>Is there anyway to delay the return of a function using <code>setTimeout()</code>?</p>
  <pre><code>function foo(){
    window.setTimeout(function(){
        //do something
    }, 500);
   //return &quot;something but wait till setTimeout() finishes&quot;;
  }
  </code></pre>