I'm trying to only style one element in an array but I'm uncertain how to write the if statement. I'd like to achieve dates[0]
returns a weight of 3
while the remaining elements in the array return a weight of 1
. Is this possible?
Function:
var dates=[]
function mostRecent(time) {
dates.push(time)
if (dates[0]){
weight = 3
} else {
weight = 1
}
return weight
}
Style:
pointToLayer: function(feature, latlng){ // changes default icons to circles and styles accordingly
return new L.CircleMarker(latlng, {
radius: circleSize(feature.properties.mag),
fillColor: getColor(feature.properties.mag),
color: "#000",
weight: mostRecent(feature.properties.time),
opacity: 1,
fillOpacity: 0.5,
});
Aucun commentaire:
Enregistrer un commentaire