I want to convert Unicode Code Points Notation like "U+1F1FA U+1F1F8" to "🇺🇸".
In javaScript, what I have tried so far is
String.fromCharCode(parseInt("U+1F1FA", 16));
But this doesn't work.
You can wrap the hex code in braces like this:
console.log('\u{1f1fa}\u{1f1f8}')
You can use the static method String.fromCodePoint()
to achieve this.
const us = String.fromCodePoint('0x1F1FA', '0x1F1F8');
console.log(us);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With