This should be simple, I am adding a marker but there is a var called location that I think is an object.
I have this in a function.
Code:
    marker = new google.maps.Marker({
      position: location,
      map: map
    });
    markersArray.push(marker);

// the alert shows the correct location, lat lon.
alert(location);

// however replace has the error "Object doesn't support this property or method"
var lat_lon = location.replace(/3/i,"");
location is passed to the function as latLon as an on click event.

Thanks for looking.