title: Not allowing Google Maps api to place a marker more than once
body: <p>I have made a html file which is integrated with javascript which lets me retrieve data for an XML file and plot them coordinates automatically onto the map. It does this because I have a timer placed into the script to tick every 4 sec so that the map can refresh on its own.
  Now i would like to be able to not let a marker be placed in the same place twice using a 'lastCoordinate' variable but not sure how to do that my first impression was to make it global then refer back to it.
  this is my code for that section;</p>
  
  <pre><code>var lastCoordinates();
  function gotdata()
  {
  
      if (xmlhttp.readyState == 4)
      {
          var y = xmlhttp.responseXML.documentElement.getElementsByTagName("y")[0].innerHTML;
          var x = xmlhttp.responseXML.documentElement.getElementsByTagName("x")[0].innerHTML;
  
          var myLatlng = new google.maps.LatLng(x,y);
          var marker = new google.maps.Marker({
            position: myLatlng,
            map: map,
            title: 'Hello World!'
        });
  
      }
  }
  </code></pre>