Skip to content

Instantly share code, notes, and snippets.

@radiovisual
Created April 10, 2016 13:19
Show Gist options
  • Save radiovisual/4985d9f1c8ccc0dae3fe4e3ee419889f to your computer and use it in GitHub Desktop.
Save radiovisual/4985d9f1c8ccc0dae3fe4e3ee419889f to your computer and use it in GitHub Desktop.
Get the character codes of all characters in a string
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