I have an array called current markers, and each time a function is called the marker is added to the array
var currentMarkers=[];
var mymarker= new mapboxgl.Marker(el)
.setLngLat(marker.geometry.coordinates
)
.addTo(map);
this.currentMarkers.push(mymarker); // pushing into the array
Is there any other method out there so that i can just update the values of the array instead of pushing new values into it? example
just my concept
this.currentMarkers[0].update(mymarker);
Thank you so much for your time !
this.currentMarkers[0] = mymarker?pushfor adding items to an array. if you want to come up with something else, thats going to hurt maintainability - especially for others reading your code.