I need to return lat-lng coordinates from google geocode api, and do something with it. So, my code seems like this:
async function getJson(url){
try {
const response = await fetch(url);
return await response.json();
}
catch (err) {
console.error(err.message);
}
}
function getLocationForName(address){
getJson(geoCodeUrl+address+apiKey).then(function(location){
return location.results[0].geometry.location;
});
}
someFunc(){
f['location'] = getLocationForName(city+f['street']+'+'+f['house']);
}
But f['location']
alwais have undefined value