Created
December 23, 2017 17:56
-
-
Save Maluen/be9252cf145eadab835c09cd0f68d611 to your computer and use it in GitHub Desktop.
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
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