Returns an integer representing the Unicode encoding of the character at the specified location.
strObj.charCodeAt(index)
The first character in a string is at index 0, the second is at index 1, and so forth.
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"; //Initialize variable. var n; //Declare variable. n =str.charCodeAt(
n - 1)
; //Get the Unicode value of the // character at position n. return(n); //Return the value. }
fromCharCode Methods | String Object methods
Applies To: String Object