fromCharCode()

The fromCharCode() method is used to return the string representation of the characters that are represented by the parameters of this method. The parameters can be any which will correspond to the ISO-Latin-1 character set. Basically, you specify the character code, and the fromCharCode() method gives you the character. As you can see from the syntax, any number of character codes may be specified. It should be noted that the fromCharCode() method is used with the String object only - a string object containing the character codes just won't work.

syntax:

String.fromCharCode(numberOne, numberTwo, etc.)

EXAMPLE

document.write("The characters corresponding to the values 121 and 100 are : " + String.fromCharCode(121) + " and " + String.fromCharCode(100) + "." )

The example shows a document.write statement that writes some descriptive text with the fromCharCode() methods getting the characters for the values 121 and 100 from the ISO-Latin-1 character set. The resulting output should be as follows:



The characters corresponding to the values 121 and 100 are : y and d.