Returns an integer representing the Unicode encoding of the character at the specified location.
Arguments
-
strObj
-
Required. Any String object or literal.
-
index
-
Required. Zero-based index of the desired character. Valid values are between 0 and the length of the string minus 1.
Remarks
Example
The following example illustrates the use of the charCodeAt method.
| Copy Code |
---|
function charCodeAtTest(n){
var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //Initialize variable.
return str.charCodeAt(n - 1); //Return Unicode value of the character.
} |
Requirements
See Also