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

JavascriptAscii

Javascript Problem Overview


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

Javascript Solutions


Solution 1 - Javascript

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 - Javascript

A reference for those of us that don't like w3schools ;)

Usage:

var myAString = String.fromCharCode(65)

Solution 3 - Javascript

The method you're looking for is String.fromCharCode (http://www.w3schools.com/jsref/jsref_fromCharCode.asp).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSakthivelView Question on Stackoverflow
Solution 1 - JavascriptCanavarView Answer on Stackoverflow
Solution 2 - JavascriptUpTheCreekView Answer on Stackoverflow
Solution 3 - JavascriptjonniiView Answer on Stackoverflow