I'm trying to convert a unified string of emoji.
Getting error when trying to do this:
var code = '1f628'
`\u{${code}}`
SyntaxError: Invalid Unicode escape sequence
How can I make it work?
String.fromCodePoint
will get you the character from its numeric code point, and parseInt
will get you the number from a hex string:
var code = '1f628';
String.fromCodePoint(parseInt(code, 16)); // 😨
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