How to get country name from alpha 2 country code using TypeScript

1 Answer

0 votes
const countryNames = new Intl.DisplayNames(
  	['en'], {type: 'region'}
);

console.log(countryNames.of('US'));
console.log(countryNames.of('GB'));
console.log(countryNames.of('AU'));
console.log(countryNames.of('FI'));


  
  
  
  
/*
run:
  
United States
United Kingdom
Australia
Finland
  
*/

 



answered Mar 23, 2022 by avibootz
...