METHOD:  String::charCodeAt


object.charCodeAt(index)

This method returns a character's Unicode value from a string by referring to its index within that string. The characters in a string are indexed from left to right with the first character indexed as 0 and the last as String.length - 1.

The following code reads a character from the string at the specified index and writes its Unicode value to the document.

Code:
myString = new String("charCodeAt method demonstration.")
document.write (myString.charCodeAt(2))

Output:
65


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information