title: How can I get assign value of success callback function result to a variable
body: <p>I want to return "currentLoc". Unfortunately, it doesn't work for me.
  How is it possible to assign result of callback function to reuse it all through my code.</p>
  
  <pre><code>function currentLocation() {
  
      var options = {
          enableHighAccuracy: true,
          timeout: 5000,
          maximumAge: 0
      };
  
      function success(pos) {
          var crd = pos.coords;
          console.log(`Latitude : ${crd.latitude}`);
          console.log(`Longitude: ${crd.longitude}`);
  
          currentLoc = new google.maps.LatLng( crd.latitude, crd.longitude);
  
      };
  
      function error(err) {
          ///ERROR
  
      };
  
      if ( navigator.geolocation) 
          navigator.geolocation.getCurrentPosition(success, error, options);
  
     return currentLoc;
  </code></pre>
  
  <p>}</p>