# Unicode
# codepoint
String.fromCharCode(55356, 57091);
String.fromCodePoint(parseInt("1f61b", 16));
String.fromCodePoint(0x1f1f3);
String.fromCodePoint(0x03c9); // in hexa-decimal
String.fromCodePoint(129321); // in decimal
- How to draw emojis, flags from unicode HTML? (opens new window)
- HTML symbols emoji (opens new window)
function countryToFlag(isoCode: string) {
return typeof String.fromCodePoint !== "undefined"
? isoCode.toUpperCase().replace(
/./g,
(char) => String.fromCodePoint(char.charCodeAt(0) + 127397) // magic number
)
: isoCode;
}
countryToFlag("IN");
countryToFlag("de");
countryToFlag("usa");
← Typescript v8 Engine →