I'm just ripping my hair out over this code! I have to be missing something obvious. I declare an array, and its type returns "object!"
code follows:
var markers = new Array();
console.log(typeof markers);
d3.json(queryUrl, function(data) {
console.log(data.features)
data.features.forEach( function(each) {
let ball = each["geometry"]["coordinates"]
console.log(typeof markers)
markers.push(
L.marker([ball[1], ball[0]])
.bindPopup(`Magnitude: ${each["properties"]["mag"]}`);
)
});
});
markers = L.layerGroup(markers);
in both console.log(typeof)
's, they return object, and the markers.push()
line raises an error (which is what prompted checking the type in the first place)
my first, knee-jerk reaction was that last line was the culprit, but I changed the first line to var test = new Array();
and it did the same thing