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

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


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

 



answered Mar 23, 2022 by avibootz

Related questions

...