title: Javascript push Object to global array overwrites previous values?
body: <p>I'm having this problem in Javascript: I want to get the longitude and latitude values from an array of Objects. This all works fine, but when I try to save it into a global array, it overwrites every previous value. The result is an array with 8 times the last pushed object.</p>
  
  <p>Global array: <code>var _coordinates = [];</code></p>
  
  <pre><code>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); // Returns different coordinates (yay)
         _coordinates.push(mark);
  
     }   
  
     console.log(_coordinates); // All coordinates are the same (meh)
  }
  </code></pre>
  
  <p>This is my first time asking a question here. So if I forgot something, please say so.</p>