title: Variable undefined after assignment
body: <p>Why is <code>resultofgetCauses</code> undefined? I'm not sure if the function is not returning <code>currentCauses</code> or if it not being assigned to <code>resultofgetCauses</code> . . . or if this has something to do with asynchronicity.</p>
  
  <pre><code>function getCauses(){
  
    var currentCauses;
    client = pg.connect(connectionString, function(err, client, done){
  
      if(err) console.log(err);
  
      client.query('SELECT * FROM causes', function(err, result){
        //console.log(result.rows);
        console.log('poo');
        currentCauses=result.rows;
        //console.log(currentCauses);
      });
  
    });
  
    return currentCauses;
  };
  
  var resultofgetCauses = getCauses();
  </code></pre>