'How to update infowindow of a marker?

enter image description here

 for(i=0; i<locations.length; i++) {
        var position = new google.maps.LatLng(locations[i][2], locations[i][3]);
        var marker = new google.maps.Marker({
            position: position,
            map: map,
        });
        google.maps.event.addListener(marker, 'click', (function(marker, i) {
            return function() {
                infowindow.setContent(locations[i][1]);
                infowindow.setOptions({maxWidth: 200});
                infowindow.open(map, marker);               
            }
        }) (marker, i));
        Markers[locations[i][4]] = marker;
    }

I have map has multiple markers with infowindows my aim is to update marker infowindow but could not manage to find a solution.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source