+ 1
Convert character into it's ASCII value with JavaScript
How can you convert a character into it's ASCII value using JavaScript? I had an idea for password encrypter and I need to get values from all the characters from the password string.
2 odpowiedzi
+ 7
Use charCodeAt().
Example of use:
"ABC".charCodeAt(0) is 65 (ASCII code of 'A').
To do the opposite, use String.fromCharCode().
Example of use:
String.fromCharCode(65) is 'A'.
String.fromCharCode(65, 66, 67) is "ABC".
0
Thanks!