Skip to content

Instantly share code, notes, and snippets.

@Maluen
Created December 23, 2017 17:56
Show Gist options
  • Save Maluen/be9252cf145eadab835c09cd0f68d611 to your computer and use it in GitHub Desktop.
Save Maluen/be9252cf145eadab835c09cd0f68d611 to your computer and use it in GitHub Desktop.
function unicodeForSymbol(code) {
var codeHex = code.toString(16).toUpperCase();
while (codeHex.length < 4) {
codeHex = "0" + codeHex;
}
return "\\u" + codeHex;
}
console.log(unicodeForSymbol(58840)); // \uE5D8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment