charAt
The charAt() method returns the character at the specified index in a string.
Interactive example
Syntax
Classic signature
typescript
function charAt(
input: string,
index: number
): stringCurried signature
typescript
function charAt<
GenericInput extends string
>(
index: number
): (input: GenericInput) => stringParameters
input: The string from which to retrieve the character.index: The index of the character to return (starts at 0).
Return value
A string representing the character at the specified index. If the index is out of bounds, returns an empty string ("").
See also
indexOf- Finds the index of a substringlastIndexOf- Finds the last index of a substring
