I'm trying to populate data for markers on map. I can get it to work using static content but I would like to set sites content by reading from an array.
var sites = [
['User 1', 45.4210328, -75.6900218, 4],
['User 2', 40.315939, -105.440630, 2],
['User 3', 43.785890, -101.90175, 1],
['User 4', 39.99948, -105.28370, 3]
];
setMarkers(map, sites);
I tried this
for (var i = 0, len = arr.length; i < len; i++)
{
var sites = [
[arr[i].username, arr[i].latitude, arr[i].longitude, i
];
}
but as a result sites only contain one array i.e. the last array. Not all the arrays. How can I create multi-dimensional array within sites?
[or missing])