Created
August 11, 2018 20:21
-
-
Save TravisMullen/178d4712c8b613df41e41b35ec087bac to your computer and use it in GitHub Desktop.
get Unicode values of character
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
// get Unicode values of character items in an array | |
function getCharactersUnicodeValue(characters) { | |
const unicodeChart = new Map(); | |
characters.forEach(character => { | |
unicodeChart.set( | |
character, | |
character.charCodeAt(character.indexOf(character)) | |
); | |
}); | |
console.table(unicodeChart); | |
} | |
// get unicode values of a single character | |
function getCharacterUnicodeValue(character) { | |
const value = character.charCodeAt(character.indexOf(character)); | |
console.log(value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment