-2
var stops = [
  {
    "Geometry": {
      "Latitude":52.1615470947258,
      "Longitude":20.80514430999756
    }
  },
  //next element of the same sort
]

我想使用 javascript 将元素推送到这个数组中。我该怎么做呢?

4

2 回答 2

1

你应该使用.push

stops.push(elements);
于 2013-04-23T07:45:37.340 回答
0

这对您的情况没有帮助吗?

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)
于 2013-04-23T07:45:22.480 回答