var stops = [
{
"Geometry": {
"Latitude":52.1615470947258,
"Longitude":20.80514430999756
}
},
//next element of the same sort
]
我想使用 javascript 将元素推送到这个数组中。我该怎么做呢?
var stops = [
{
"Geometry": {
"Latitude":52.1615470947258,
"Longitude":20.80514430999756
}
},
//next element of the same sort
]
我想使用 javascript 将元素推送到这个数组中。我该怎么做呢?
你应该使用.push
:
stops.push(elements);
这对您的情况没有帮助吗?
var stops = [{"Geometry":"Latitude":52.1615470947258,"Longitude":20.80514430999756}},next element of the same sort}]
var newStops = {"Geometry2":{"Latitude":52.1615470947258,"Longitude":20.80514430999756}}
stops.push(newStops)