'use strict';

var map;
function initMap() {
  map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: -34.397, lng: 150.644},
    zoom: 21,
  });

  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      var pos = {
        lat: position.coords.latitude,
        lng: position.coords.longitude
      };


        // var myCar = new google.maps.Circle({
        //   strokeColor: 'blue',
        //   strokeOpacity: 0.8,
        //   strokeWeight: 2,
        //   fillColor: 'blue',
        //   fillOpacity: 0.5,
        //   map: map,
        //   center: {lat: position.coords.latitude, lng: position.coords.longitude},
        //   radius: 1,
        //   draggable: true
        // });
        // var otherCar = new google.maps.Circle({
        //   strokeColor: 'red',
        //   strokeOpacity: 0.8,
        //   strokeWeight: 2,
        //   fillColor: 'red',
        //   fillOpacity: 0.5,
        //   map: map,
        //   center: {lat: position.coords.latitude, lng: position.coords.longitude + 0.00003},
        //   radius: 1,
        //   draggable: true
        // });
        // var arrow = new google.maps.Marker({
        //   center: {lat: position.coords.latitude, lng: position.coords.longitude + 0.00003},
        //   map: map,
        //   path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW
        // })

      map.setCenter(pos);
    }, function() {
      handleLocationError(true, infoWindow, map.getCenter());
    });
  } else {
    // Browser doesn't support Geolocation
    handleLocationError(false, infoWindow, map.getCenter());
  }

  map.addListener('click', function(e) {
    placeMarkerAndPanTo(e.latLng, map);
  });

  function placeMarkerAndPanTo(latLng, map) {
    var marker = new google.maps.Marker({
      position: latLng,
      map: map
    });
    //this code (latLng.lat().toFixed(3) gets the latitude for wherever the user placed the marker)
    console.log(latLng.lat().toFixed(3));
    map.panTo(latLng);
  }
}

@@ -1470,28 +1470,16 @@
 or(true,
- infoWindow,
  map.get
@@ -1585,20 +1585,8 @@
 lse,
- infoWindow,
  map
@@ -1661,24 +1661,16 @@
 ceMarker
-AndPanTo
 (e.latLn
@@ -1711,16 +1711,8 @@
 rker
-AndPanTo
 (lat
@@ -1953,17 +1953,17 @@
 xed(
-3
+6
 ));%0A    
 map.
@@ -1962,24 +1962,43 @@
     
-map.panTo(latLng
+console.log(latLng.lng().toFixed(6)
 );%0A 

write functions to collect longitude too