Convert character into it's ASCII value with JavaScript | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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.

2nd Nov 2016, 6:18 PM
Petar Mijailović
Petar Mijailović - avatar
2 Respostas
+ 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".
2nd Nov 2016, 9:41 PM
Zen
Zen - avatar
0
Thanks!
2nd Nov 2016, 9:56 PM
Petar Mijailović
Petar Mijailović - avatar