How to create a string or char from an ASCII value in JavaScript?

Sakthivel picture Sakthivel · Mar 2, 2009 · Viewed 91.3k times · Source

In JavaScript, how to get a string representation of an ASCII value, e.g. how to turn 65 into A?

Answer

Canavar picture Canavar · Mar 2, 2009

The fromCharCode method converts ASCII to a string:

<script type="text/javascript">
document.write(String.fromCharCode(65,66,67)); // ABC
</script>

Hope this helps!