title: More efficient way to extract address components
body: <p>Currenty, I'm using the following code to get the country, postal code, locality and sub-locality:</p>
  
  <pre><code>var country, postal_code, locality, sublocality;
  for (i = 0; i &lt; results[0].address_components.length; ++i)
  {
      for (j = 0; j &lt; results[0].address_components[i].types.length; ++j)
      {
          if (!country &amp;&amp; results[0].address_components[i].types[j] == "country")
              country = results[0].address_components[i].long_name;
          else if (!postal_code &amp;&amp; results[0].address_components[i].types[j] == "postal_code")
              postal_code = results[0].address_components[i].long_name;
          else if (!locality &amp;&amp; results[0].address_components[i].types[j] == "locality")
              locality = results[0].address_components[i].long_name;
          else if (!sublocality &amp;&amp; results[0].address_components[i].types[j] == "sublocality")
              sublocality = results[0].address_components[i].long_name;
      }
  }
  </code></pre>
  
  <p>That's unsatisfactory. Is there any other way to achieve the same result?</p>