I have a series of locations returning in an array in JavaScript that I'm plotting on a Google Map.
I'm trying to change the type of marker icon depending the value on one of the array elements like so
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
if (locations[i][3] == "Yes") {
console.log("yes")
} else {
console.log("no")
}
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
but running into
Uncaught SyntaxError: Unexpected token (
What am I missing?