title: get visitor's lat & long and display google map of it
body: <p>I'm trying to get visitor's location and then display their location using a map.</p>
  
  <p>I tried passing lat and long values to variables a and b and then using that to display a map.</p>
  
  <pre><code>  &lt;p&gt; You are visiting me from:
  
    &lt;button onclick="getLocation()"&gt;Click Here&lt;/button&gt;
    &lt;/p&gt;
    &lt;p id="geoLoc"&gt;&lt;/p&gt;
  
    &lt;script&gt;
      var x = document.getElementById("geoLoc");
      var a = 0;
      var b = 0;
  
      function getLocation() {
        if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(showPosition);
        } else {
          x.innerHTML = "Geolocation is not supported by this browser.";
        }
      }
  
      function showPosition(position) {
         a = position.coords.latitude;
          b = position.coords.longitude;
        x.innerHTML = "Latitude: " + a +
          "&lt;br&gt;Longitude: " + b;
  
      }
      function initMap() {
    // The location of visitor
    var uluru = {lat: a, lng: b};
    // The map, centered at visitor
    var map = new google.maps.Map(
        document.getElementById('map'), {zoom: 4, center: uluru});
    // The marker, positioned at visitor
    var marker = new google.maps.Marker({position: uluru, map: map});
  }
    &lt;/script&gt;
    &lt;h3&gt; Map of Your Location&lt;/h3&gt;
    &lt;div id = "map"&gt;&lt;/div&gt;
      &lt;script async defer
      src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&amp;callback=initMap"&gt;
      &lt;/script&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>expected: see the map with marker on the location passed by latitude and longitude</p>
  
  <p>actual: nothing</p>