title: Sub stringing lat and lng resulted from google maps
body: <p>I have wrote a code that copies a latitude and longitude precisely by using sub string as the given result from google is a whole string of numbers  - something like this: <code>"(40.40926169999999, 49.86709240000005)"</code>. </p>
  
  <p>But  when I search for a location in a map, however when I remove the <code>console.log()</code> from the function and then call it later on, it gives me an undefined result, excuse me for the bad English.</p>
  
  <p>code : </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>test = "(40.40926169999999, 49.86709240000005)"
  
  function cutLat (string)
  {
    for (i=0; i&lt;string.length; i++)
      {
        if (string[i] === "," &amp;&amp; string[i+1] === " ")
         {
          string.substring(1,i);
         }
       }   
  }
  
  
  function cutLng (string)
  {
   for (i=0; i&lt;string.length; i++)
   {
    if (string[i] === "," &amp;&amp; string[i+1] === " ")
    {
    string.substring(i+2,string.length-1);
    }
   }
  }
  
  
  
  console.log(cutLat(test))</code></pre>
  </div>
  </div>
  </p>