title: Can assignments be deferred and execution of current block continue?
body: <p>I have been given some educational literature explaining asynchronous happenings in JS...</p>
  
  <blockquote>
    <p>Take the following example where, server1 is a different server to the one running the website and the getData() function will execute a complex SQL query and then <strong>return a large dataset</strong>:</p>
  </blockquote>
  
  <pre><code>var data = server1.getData();  
  console.log(data);
  </code></pre>
  
  <blockquote>
    <p>We can be almost certain that the console will say <code>undefined</code>. This is because the 2nd line of code will be executed before the result of getData() is returned.</p>
  </blockquote>
  
  <p>My understanding is that the 2nd line will only be executed when then function has returned and its return value is assigned to <code>data</code>. If, indeed, getData() returns 'a large dataset', then by the time we get to the 2nd line <code>data</code> will be, 'a large dataset'.</p>
  
  <p>Can assignment be deferred like this? I'm very familiar with async calls to remote servers and handling them through callbacks. But I believe that a simple function call in JS will return once (at most) and code is essentially executed single-threaded and sequentially executed.</p>
  
  <p>Is this documentation somewhat misleading in its attempts to explain the pitfalls of asynchronous programming, however well intentioned? </p>