A simple Javascript UMD tool for ISO country codes.
<script
crossorigin
src="https://raw.githubusercontent.com/jayPare/CountryCodes/main/countryCodes.js"
></script>
code = countryCodes.countryToCode("Canada"); // code == "CA"
code = countryCodes.countryToCode3("Canada"); // code == "CAN"
code = countryCodes.codeToCode3("CA"); // code == "CAN"
code = countryCodes.codeToCode3("CAN"); // code == "CA"
code = countryCodes.codeToCountry("CA"); // code == "Canada"
code = countryCodes.code3ToCountry("CAN"); // code == "Canada"
- Missing countries coming soon.