Returns a string from some Unicode character values.
String. fromCharCode ([code1 [, code2 [,... [, codeN])
Parameters
String
Required. Is a String object.
Code1,..., codeN
Optional. Is the sequence of Unicode character values to be converted to strings. If no parameter is provided, the result is a null string.
Description
You do not need to create a String object before calling fromCharCode.
In the following example, test contains the string "plain ":
Var test = String. fromCharCode (112,108, 97,105,110 );
CharCodeAt Method
Returns an integer representing the Unicode encoding of the characters at the specified position.
StrObj. charCodeAt (index)
Parameters
StrObj
Required. Any String object or text.
Index
Required. Number that counts the characters to be processed from scratch. The valid value is a number ranging from 0 to 1 minus the string length.
Description
The first character in a string is 0, the second character is 1, and so on.
If the specified position does not contain any characters, NaN is returned.
Example
The following example illustrates the usage of the charCodeAt method.
Function charCodeAtTest (n ){
Var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // initialize the variable.
Var n; // declare the variable.
N = str. charCodeAt (n-1); // obtain the Unicode value of the character at the position n.
Return (n); // return this value.
}