Return location name from geocoder funtion


#1

This is my typescript code.

locationName: string;
getlocation() {
    let options = {
      enableHighAccuracy: true
    };
    this.geolocation.getCurrentPosition(options).then((position: Geoposition) => {
      this.getcountry(position);
      console.log(this.locationName);
    }).catch((err) => {
      console.log(err);
    })
    
  }
  getcountry(pos) {
    this.nativeGeocoder.reverseGeocode(pos.coords.latitude, pos.coords.longitude)
    .then((res: NativeGeocoderReverseResult) => {
      return res.countryName + "," + res.locality;
    }).catch((err) => {
      console.log(err);
    });
  }

I want return

res.countryName + “,” + res.locality
to the variable called locationName.How can I get it?