How to store the long lat globally

Hi im having a problem with storing the long lat result to the this.long and variables, when i store it there nothings being stored, it will only return ‘undefined’ can you please help me with this?

var geocoder = new google.maps.Geocoder();



geocodeAddress(geocoder) {
var address =;
geocoder.geocode({‘address’: address}, function(results, status) {
if (status === ‘OK’) {
console.log(; = results[0];
this.long = results[0].geometry.location.lng();
} else {
alert('Geocode was not successful for the following reason: ’ + status);