I need to reverse this condtion, That means United States to US. I try to find out on Google but can't. How can I do it?
let regionNames = new Intl.DisplayNames(['en'], {type: 'region'});
console.log(regionNames.of('US')); // "United States"
I need to reverse this condtion, That means United States to US. I try to find out on Google but can't. How can I do it?
let regionNames = new Intl.DisplayNames(['en'], {type: 'region'});
console.log(regionNames.of('US')); // "United States"
This library should help
https://www.npmjs.com/package/country-code-lookup