title: How to get a value out of a callback function in javascript
body: <pre><code>var request = require('request');
  var d;
  request('my.servers.ip?group=1', function (error, response, body) {
          let d = body
  })
  console.log(d)
  </code></pre>
  <p>This is my code currently, it says the variable <code>d</code> is undefined and I'm not sure why.</p>
  <p>Anyone have ideas on why it might be?</p>