How to get country name from alpha 2 country code using Node.js

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('AT'));

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

 



answered Mar 23, 2022 by avibootz
...