Skip to content

Instantly share code, notes, and snippets.

@jz222
Created April 14, 2021 12:24
Show Gist options
  • Select an option

  • Save jz222/2c47586f4816b9524a27670fed913f4e to your computer and use it in GitHub Desktop.

Select an option

Save jz222/2c47586f4816b9524a27670fed913f4e to your computer and use it in GitHub Desktop.
A function that returns the flag emoji for a given country code.
const getFlag = (countryCode) => String.fromCodePoint(...[...countryCode.toUpperCase()].map(x => 0x1f1a5 + x.charCodeAt()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment