Created
April 10, 2016 13:19
-
-
Save radiovisual/4985d9f1c8ccc0dae3fe4e3ee419889f to your computer and use it in GitHub Desktop.
Get the character codes of all characters in a string
This file contains hidden or 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
var str = '[]{}:,"\''; | |
for (var i = 0; i < str.length; i++) { | |
console.log(str[i], str.charCodeAt(i)); | |
} | |
/* | |
[ 91 | |
] 93 | |
{ 123 | |
} 125 | |
: 58 | |
, 44 | |
" 34 | |
' 39 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment