title: What is the difference between synchronous and asynchronous programming (in node.js)
body: <p>I've been reading <a href="http://www.nodebeginner.org/" rel="noreferrer">nodebeginner</a>
  And I came across the following two pieces of code.</p>
  
  <p>The first one:</p>
  
  <pre><code>    var result = database.query("SELECT * FROM hugetable");
      console.log("Hello World");
  </code></pre>
  
  <p>The second one:</p>
  
  <pre><code>    database.query("SELECT * FROM hugetable", function(rows) {
         var result = rows;
      });
      console.log("Hello World");
  </code></pre>
  
  <p>I get what they're supposed to do, they query the database to retrieve the answer to the query. And then <code>console.log('Hello world')</code>.</p>
  
  <p>The first one is supposedly synchronous code. 
  And the second one is asynchronous code.</p>
  
  <p>The difference between the two pieces is very vague to me. What would the output be?</p>
  
  <p>Googling on asynchronous programming didn't help me either. </p>