title: NodeJS global variable within a request function
body: <p>I have currently following code:</p>
  
  <pre><code>var request = require('request');
  
  var variable1;
  
  request('https://api.coindesk.com/v1/bpi/currentprice/EUR.json', function (error, response, body){
      var btceurpricejson = (body);
      var obj = JSON.parse(btceurpricejson);
      variable1 = (obj.bpi.EUR.rate_float);
  });
  
  function getBTCItemPrice() {
          console.log(variable1);
  };
  
  getBTCItemPrice();
  </code></pre>
  
  <p>But it always only outputs <code>undefined</code>. When I use <code>console.log(variable1);</code> in the request function, it works. But when I use it like above, in another function, it doesn't work. Even though I use a global variable.</p>
  
  <p>Thank you in advance!</p>