How to get the ASCII value of a character#

To get the ASCII value of a character, use the charCodeAt instance method of the String JavaScript object. Example:

Run
Clear

To convert a string of characters to ASCII values, you can do something like this:

Run
Clear

To convert an ASCII value to its corresponding character use the fromCharCode static method of the String JavaScript object. Example:

Run
Clear

Reference#

  1. MDN - String​.prototype​.char​CodeAt()
  2. MDN - String​.from​Char​Code()
Tweet this | Share on LinkedIn |