title: Google Map API - Removing Markers
body: <p>I've tried looking at a large variety of code blocks here and on the Google Maps API documentation but STILL have not been able to figure out how to hide markers.</p>
  
  <p>This is the current code that I am using, and it worked for one instance. Once I added the "for" loop in the function with markers.setMap(null) Firefox displays the following error:</p>
  
  <p><strong>Error</strong>: TypeError: markers.setMap is not a function</p>
  
  <pre><code>function removeMarkers(){
      var markers;
      alert(markers);
      alert(locations.length);
      for (i = 0; i&lt;locations.length; i++){
          markers = locations[i];
          alert(markers.title);
          markers.setMap(null);
      }
  }
  </code></pre>
  
  <p>Additional Information: <a href="https://www.rose-hulman.edu/visit/maps-and-directions/interactive-map.html" rel="noreferrer">Campus Map</a> and <a href="http://jsfiddle.net/hbuPY/" rel="noreferrer">full code</a> (excluding Map API)</p>