code: function renderMarkerAtLocationsHelper(marker, locations, delayInMilliseconds) {
      if (locations.length) {
        /* render next location */
        var location = locations.shift();
        marker.setPosition(new window.google.maps.LatLng(location.lat, location.lng));
        if (!marker.getMap()) {marker.setMap(mapObject);}
        /* after delay, recurse with shifted array */
        window.setTimeout(function () {
          renderMarkerAtLocationsHelper(marker, locations, delayInMilliseconds);
        }, delayInMilliseconds);
      } else {
        /* all locations have been rendered, so remove marker */
        marker.setMap(null);
        delete marker;
      }
    }
docs: renderMarkerAtLocations (and renderMarkerAtLocationsHelper)
  Renders a marker at several different locations (emulating movement).
  @param {Object} marker A google.maps.marker.
  @param {Array} locations An array of lat/lng pair objects in sequential order.
  @param {integer} delayInMilliseconds The delay between frames in milliseconds.
  @returns {boolean} result Whether or not the input values are valid.