In JavaScript, how to get a string representation of an ASCII value, e.g. how to turn 65
into A
?
How to create a string or char from an ASCII value in JavaScript?
Asked Answered
you may mark his answer as correct. There's a little check right below the downvote arrow. –
Eveleen
See also: [How to convert from Hex to ASCII in javascript?][1] [1]: #3746166 –
Asset
The fromCharCode method converts ASCII to a string:
<script type="text/javascript">
document.write(String.fromCharCode(65,66,67)); // ABC
</script>
See also MDN docs. –
Strongroom
A reference for those of us that don't like w3schools ;)
Usage:
var myAString = String.fromCharCode(65)
The method you're looking for is String.fromCharCode (http://www.w3schools.com/jsref/jsref_fromCharCode.asp).
charCodeAt()
method can be used to get the ASCII value.
The question asks the other way. –
Walford
however the question asks the other way, it's good to also have this referenced, but a little explanation may fit. –
Euniceeunuch
© 2022 - 2024 — McMap. All rights reserved.