1
I have the following function:
function (markers) {
const geocoder = new google.maps.Geocoder()
const geocodingResults = []
markers.forEach((latLong) => {
geocoder.geocode({ 'location': latLong }, (result, status) => {
// console.log(results, status)
if (status !== 'OK') { return false }
geocodingResults.push(result)
})
})
console.log('geocodingResults', geocodingResults)
return geocodingResults.map((address) => {
console.log('address', address)
return address[0].address_components[1].short_name
})
}
In the console I receive geocoding Results being an array of size 2 but never get the log "address", what can this happen ? my map is not running ?
What result of
console.log('geocodingResults', geocodingResults)
?– Elanio
https://pastebin.com/eXtvspBq
– Igor Oliveira
Have you tried removing the Return before the map? Instead of Return put a variable, and off a console map in the variable.
– LeAndrade
You can add the result of
console.log(JSON.stringify(geocodingResults))
to make it easier to view?– Costamilam