Is it possible to add if statement into my code inline where the var marker is being set ?
The code;
for (var i = 0; i < addressPoints.length; i++) {
var a = addressPoints[i];
var title = a[1];
var customPopup_3 = " ";
var marker = L.marker(new L.LatLng(a[9], a[8]), {
title: title,
icon: a[11]
});
marker.bindPopup(customPopup_3, customOptions);
markers.addLayer(marker);
}
map.addLayer(markers);
}
The things I need to do is add if statement in
var marker = L.marker(new L.LatLng(a[9], a[8]), {
title: title,
icon: a[11]
});
This section , so it will look like this:
var marker = L.marker(new L.LatLng(a[9], a[8]), {
title: title,
if (a[6] == 3) {
icon: a[11]
} else {
icon: a[12]
}
});