Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeroseis/1cb48c398156e3cbb47c262d9e2765b5 to your computer and use it in GitHub Desktop.
Save zeroseis/1cb48c398156e3cbb47c262d9e2765b5 to your computer and use it in GitHub Desktop.
How to convert emoji code to Javascript unicode scape sequence
// 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