I can't set value inside function. When I try to alert this value, I'm getting: undefined. How to take this value outside?
var startTrasyLat;
L.esri.Geocoding.geocode()
.text(document.getElementById('start').value)
.run(function (err, results, response) {
if (err) {
console.log(err);
return;
}
startTrasyLat = results['results'][0].latlng.lat;
});
alert(startTrasyLat);