Name
String.charCodeAt( ): get the ‘n’th character code from a string — ECMAScript v1
Synopsis
string.charCodeAt(n)
Arguments
-
n The index of the character whose encoding is to be returned.
Returns
The Unicode encoding of the nth
character within string. This return
value is a 16-bit integer between 0 and 65535.
Description
charCodeAt( ) is like
charAt( ), except that it returns
the character encoding at a specific location, rather than returning
a substring that contains the character itself. If
n is negative or greater than or equal to
the string length, charCodeAt( )
returns NaN.
See String.fromCharCode( )
for a way to create a string from Unicode encodings.
See Also
String.charAt( ), String.fromCharCode( )
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access