I am working on node.js library called node-geocoder. I am trying to create a function which will return only country name. My code is given below:
const NodeGeocoder = require('node-geocoder');
var NodeGeocoderOptions = {
  provider: 'google',
  // Optional depending on the providers
  httpAdapter: 'https',
  apiKey: gmapkey,
  formatter: null         
};
var geocoder = NodeGeocoder(NodeGeocoderOptions);
// get country
function getCountry(lat, long){
    country_name = "";
    geocoder.reverse({lat:lat, lon:long}, function(err, res) {
      // country_name = res[0].country;
      country_name += res[0].country;
    });
    console.log("Country Name is " + country_name);
    return country_name;
}
I am getting the response.how can i return country name.
Thanks in advance.
