Microsoft® JScript® charCodeAt Method |
Language Reference Version 3 |
Description
Returns the Unicode encoding of the specified character.
Syntax
stringObj.charCodeAt(index)
The charCodeAt method syntax has these parts:
Part Description stringObj Required. A String object or literal. index Required. The zero-based index of the specified character.
Remarks
If there is no character at the specified index, NaN is returned.The following example illustrates the use of the charCodeAt method:
function charCodeAtTest(n) { var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var s; s = str.charCodeAt(n - 1); // Return Unicode character code. return(s); }