Google Maps InfoWindow only displaying last element in JSON array


#1

I am trying to display a title in each markers info window that will display the name of the event. Right now I only can display the very last elements name in the JSON array, and am unsure how to make the others their event title. Any help is appreciated, thanks! I would also like to eventually show along with the event name a couple other elements such as “eventPhone” etc.

The info window only showing last element: (Santa clause parade is title of every marker for some reason)

what the array looks like:

My add markers function:

addMarkersMap(markers){
for(let marker of markers)
{ 
var loc = marker.calEvent.locations[0]['coords'];
var name = marker.calEvent['eventName'];

console.log(name); //displays name of each event within this object

marker = new google.maps.Marker({
position: loc,
map: this.map,

 });


var infoWindow = new google.maps.InfoWindow({

content: name
}); 

google.maps.event.addListener(marker, 'click', function () {
InfoWindow.open(this.map, marker);
  });


}
}

JSON feed:

http://app.toronto.ca/cc_sr_v1_app/data/edc_eventcal_APR?limit=500