I have this problem in Javascript: I want to get the longitude and latitude values ββfrom an array of objects. This all works great, but when I try to store it in a global array, it overwrites every previous value. The result is an array with the 8x last clicked object.
Global array: var _coordinates = [];
function getCoordinates() { mark = {}; for(var key in _data) { if(_data.hasOwnProperty(key)){ mark["lng"] = _data[key].long; mark["lat"] = _data[key].lat; } console.log(mark);
This is my first question asking a question here. Therefore, if I forgot something, say so.
source share