Hi - I am trying to show markers on leaflet map. right now, the map is displayed and gets the array of location addresses from .js file. but still the marker is not shown. I have the below code to show marker which is not working yet. and there is no error and when I step through the code I see values for marker, lat, lon etc. i suspect when i put the addLayer //line 1 code inside the for loop maybe not showing the markers. please let me know what i am doing wrong.
function showStoresMarkers() {
for(var [index, store] of stores.entries()) {
lon = store["coordinates"]["latitude"];
lat =store["coordinates"]["longitude"];
markerLocation = new L.LatLng(lat, lon);
marker = new L.Marker(markerLocation);
mymap.addLayer(marker); //line 1
}
}