I am trying to receive an array of results from a function as follows:
getSearchLocation(){
let results = [];
geocoder.geocode( { 'address': address}, function(results, status) {
console.log("in scope", results);
return results;
});
console.log("out of scope", results);
}
"in scope" results returns the array as it should be.
"out of scope" results returns a length: 0 empty array.
If I returned results
array from geocoder.geocode()
, isn't it supposed to assign it to the declared results array in getSearchLocation()
?
Thanks, Bud