Name
String.charAt( ): get the ânâth character from a string â ECMAScript v1
Synopsis
string
.charAt(n
)
Arguments
-
n
The index of the character that should be returned from
string
.
Returns
The n
th character of
string
.
Description
String.charAt( )
returns
the n
th character of the string
string
. The first character of the string
is numbered 0. If n
is not between 0 and
string.length
â1, this method returns an
empty string. Note that JavaScript does not have a character data
type that is distinct from the string type, so the returned
character is a string of length 1.
See Also
String.charCodeAt( )
,
String.indexOf( )
, String.lastIndexOf( )
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.