Nested functions in Javascript with a return value
<p>I would say I'm a beginner transitioning into intermediate programmer and I don't completely understand closures as well as nested functions with return values. I've done some reading and can't really wrap my head around it.</p>

<p>The following code will only return undefined. I'm going to assume this is because it's a nested function but I'm not sure I understand how to fix it.</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var Twit = require('twit');
var request = require('request');

var T = new Twit({
  consumer_key:         'Removed for security reasons',
  consumer_secret:      'Removed for security reasons',
  access_token:         'Removed for security reasons',
  access_token_secret:  'Removed for security reasons',
});

var stream = T.stream('statuses/filter', {track: '#instagram'});

stream.on('tweet', function(tweet){
  if(!tweet.entities.media){
    console.log("No photo here");
  }else{
    var imageUrl = JSON.stringify(tweet.entities.media[0].media_url).replace(/^"(.*)"$/, '$1');
    console.log(describeImage(imageUrl) + " - " + imageUrl);
  }
});


function describeImage(imageUrl){
  
var options = {
    url: "https://api.projectoxford.ai/vision/v1.0/describe?maxCandidates=1",
    json: {url: imageUrl},
    method: 'POST',
    headers: {
      'Content-type' : 'application/json',
      'Ocp-Apim-Subscription-Key' : 'Removed for security reasons'
    }
}

  request(options, function(err, res, body){
    if(err){
      console.log(err);
    }
    //This is where I'm going wrong.
    return JSON.stringify(body.description.captions[0].text);
  });
  
  
}</code></pre>
</div>
</div>
</p>

<p>Any help would be wonderful!</p>