Created
April 3, 2020 01:15
-
-
Save zeroseis/1cb48c398156e3cbb47c262d9e2765b5 to your computer and use it in GitHub Desktop.
How to convert emoji code to Javascript unicode scape sequence
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
// Run this code in the browser's console | |
// Replace de 'emoji' constant code by the one you need to convert | |
const emoji = '\u{1F639}'; | |
highSurrogate = emoji[0].codePointAt(0).toString(16); | |
lowSurrogate = emoji[1].codePointAt(0).toString(16); | |
console.log(`Unicode for "${emoji}" = \\u${highSurrogate}\\u${lowSurrogate}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment