title: Getting all country codes from libphonenumber-js and looping it out
body: <p>I have a contact number input field and I was able to prepend a country code dropdown to the input field.</p>
  <p>Now when user selects the country code, the number format will change according to the selected country code.</p>
  <p>My question now is how do you loop all the country code out from the library and put it into the dropdown? I tried using some functions like &quot;getSupportedRegions();&quot; but it is saying undefined. I already have the script-src included in the head, am I doing it wrong?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://unpkg.com/libphonenumber-js@^1.7.6/bundle/libphonenumber-min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;label for="inputContactNumber"&gt;Contact Number&lt;/label&gt;
          &lt;div class="input-group mb-3"&gt;
              &lt;div class="input-group-prepend"&gt;
  
          
              &lt;select class="select-country" class="btn contact-btn dropdown-toggle"&gt;
                  &lt;option&gt;SG&lt;/option&gt; 
                  &lt;option&gt;MY&lt;/option&gt;
                  &lt;option&gt;US&lt;/option&gt;
                  &lt;option&gt;TH&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;input class="input-phone phone-format" class="form-control phone-format" type="text" name="contactNo" placeholder="Enter contact number" required//&gt;
      &lt;/div&gt;
  
  
  &lt;script type="text/javascript"&gt;
  
       $(".phone-format").keyup(function () {
              var val_old = $(this).val();
              var newString = new libphonenumber.AsYouType($(".select-country").val()).input(val_old);
              $(this).focus().val('').val(newString);
      });
  &lt;/script&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>