Hey all I currently have the forEach method below in an array
let distances = []
markers.forEach((el) => {
new google.maps.DirectionsService().route({
origin: address,
destination: el.address,
travelMode: google.maps.TravelMode.DRIVING
})
.then((response) => {
distances.push(response)
// For each route, display summary information.
})
.catch((e) => console.log('Directions request failed due to ' + status))
console.log(distances)
})
does anyone know why I cant see the items after they are all pushed ?