Created
September 1, 2021 08:59
-
-
Save talha08/35ea0f5d352bda38fe9c88e576bbf64b to your computer and use it in GitHub Desktop.
Country Code To Flag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getFlagEmoji = countryCode => { | |
return String.fromCodePoint(...[...countryCode.toUpperCase()].map(x=>0x1f1a5+x.charCodeAt())); | |
} | |
console.log(getFlagEmoji('US')) // "🇺🇸" | |
console.log(getFlagEmoji('BD')) // "🇧🇩" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment