title: Match the two letter country code to predefined array of country code
body: <p>I am trying to get the country code of the user's current location using Javascript. With the code, I have, I will be getting two letter country code and then I need to match that two letter country code with my predefined array to get the three letter country code.</p>
  
  <p>Below is my code, but it is not working as soon as I added my predefined array things for three letter country code. none of my alert box are working now.</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Get web visitor's location&lt;/title&gt;
  
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
  
      var threeLtrCC.US = 'USA';
      var threeLtrCC.IN = 'IND';
  
  $(document).ready( function() {
  
      $.getJSON( "http://smart-ip.net/geoip-json?callback=?",
          function(data){
              alert( data.countryCode);
              var cc = threeLtrCC[data.countryCode];
              var countryCode=data.countryCode
  
              alert(cc);
              $('#newURL').attr('href','https://www.google.com&amp;jobid='+countryCode);
          }
      );
  }); 
  
      &lt;/script&gt;
  
      &lt;/head&gt;
      &lt;body&gt;
  &lt;hr/&gt;
  
  &lt;a id="newURL"&gt;url&lt;/a&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>It is not alerting me anything. Suppose if the country code is US, then it should get matched with my predefined array and print it out as USA.</p>
  
  <p>What wrong I am doing?</p>