In JavaScript, how to get a string representation of an ASCII value, e.g. how to turn 65
into A
?
To convert ASCII to string, use the toString() method. Using this method will return the associated character.
fromCharCode() method converts Unicode values to characters. The String. fromCharCode() is a static method of the String object. The syntax is always String.
The fromCharCode method converts ASCII to a string:
<script type="text/javascript"> document.write(String.fromCharCode(65,66,67)); // ABC </script>
Hope this helps!
A reference for those of us that don't like w3schools ;)
Usage:
var myAString = String.fromCharCode(65)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With