title: Getting Latitude from Geocode Object
body: <p>I want to get the latitude and longitude from the result object returned by geocoder.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no"/&gt;
  &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"/&gt;
  &lt;title&gt;Smart Minds&lt;/title&gt;
  &lt;link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    var geocoder;
    var map;
    function initialize() {
      geocoder = new google.maps.Geocoder();
      var latlng = new google.maps.LatLng(-34.397, 150.644);
      var myOptions = {
        zoom: 4,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    }
  
    function codeAddress() {
      var address = document.getElementById("address").value;
      geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
          map.setCenter(results[0].geometry.location);
          var marker = new google.maps.Marker({
              map: map,
              position: results[0].geometry.location
          });
  
  
  
          var inp=results[0].geometry.location;
  
  
          alert(inp);
        } else {
          alert("Geocode was not successful for the following reason: " + status);
        }
      });
    }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onLoad="initialize()"&gt;
  
  
    &lt;!--&lt;/div&gt;--&gt;
  &lt;!--&lt;div id="map_canvas" style="height:80%;top:30px;right:40%;left:20%"&gt;&lt;/div&gt;--&gt;
   &lt;div id="map_canvas" style="border-width:0;width:500px;height:500px;left:40px;right:60px;top:20px"&gt;&lt;/div&gt;
  
    &lt;input id="address" type="textbox" value="" style="margin-top:60px;margin-left:400px;" placeholder="Enter your Location"&gt;
      &lt;input type="button" value="Get me There" onClick="codeAddress()"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The <code>results[0].geometry.location</code> contains both the latitude and the longitude but I want to get separate values of longitude and latitude. I had tried to use a javascript function like split() and slice() on  <code>results[0].geometry.location</code> but that is not working. Can anyone please tell me how I can do that?</p>