How to create a string or char from an ASCII value in JavaScript?
93,903
Solution 1
The fromCharCode method converts ASCII to a string:
<script type="text/javascript">
document.write(String.fromCharCode(65,66,67)); // ABC
</script>
Hope this helps!
Solution 2
A reference for those of us that don't like w3schools ;)
Usage:
var myAString = String.fromCharCode(65)
Solution 3
The method you're looking for is String.fromCharCode (http://www.w3schools.com/jsref/jsref_fromCharCode.asp).
Author by
PCripps
Updated on January 18, 2020Comments
-
PCripps over 4 years
In JavaScript, how to get a string representation of an ASCII value, e.g. how to turn
65
intoA
? -
Michał Perłakowski over 8 yearsSee also MDN docs.