Nate Nate - 26 days ago 17
Javascript Question

Google Maps API Marker Visibility

I am creating a game where I want the user to find certain locations on the map. I have currently created the location for Chicago, but I would like the marker to be invisible. How would I do this?

function initMap() {
var chicago = {lat: 41.8781, lng: -87.6298};
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 0.0, lng: 0.0},
zoom: 1
var chicagoMarker = new google.maps.Marker({
position: chicago,
map: map


If you want to keep the marker in the JS memory, but remove it from the map, you can set the map to null in the marker object: