title: Why is my variable still undefined?
body: <p><code>lastbalance</code> never get's defined and because of that the function getBalance never does what its supposed to. I thought this might be an issue with asynchronicity but that could only be the case before the first interval, right? Any ideas?</p>
  
  <pre><code>var lastbalance;
  getBalance = function (lastbalance, callback){
    btcclient.getBalance('*', 0, function(err, balance) {
      if (err) return console.log(err);
      if (lastbalance != balance || typeof lastbalance == 'undefined'){
        console.log('Last Balance:' + lastbalance);
        var lastbalance = balance;
        updateCauses();
      }
      console.log('Balance:', balance);
  
  
      if (typeof callback=='function') callback();
  
    });
  };
  
  setInterval(getBalance, 2000, lastbalance);
  </code></pre>