I have a array of markers named markers
and i add those markers in map using LeafletJs
L.layerGroup(markers).addTo(map);
Now i want to focus on a viewport that covers all markers
var bounds = L.latLngBounds(markers);
map.fitBounds(bounds, { padding: [20, 20] });
Why i get Cannot read property 'lat' of undefined
error message in map.fitBounds(bounds, { padding: [20, 20] });
line.