The charAt() method in TypeScript is used to return the character at the specified index of the string. The characters string are indexed from left to right.
string.charAt( index )
Parameter: This method accepts a single parameter as mentioned above and described below:
- index: It is an integer value between 0 and 1 less than the length of the string.
Return Value: This method returns a character for the given index in the argument.
Below examples illustrate the working of charAt() method in TypeScript:
str.charAt(0) is:J str.charAt(1) is:a