Return the third character of a string:
The result of n will be:
The charAt() method returns the character at the specified index in a string.
The index of the first character is 0, the second character is 1, and so on.
![]()
The charAt() method is supported in all major browsers.
| Parameter | Description |
|---|---|
| index | Required. An integer representing the index of the character you want to return |
| Type | Description |
|---|---|
| String | The character at the specified index |
| JavaScript Version: | 1.0 |
|---|
Return last character of a string:
The result of n will be:
JavaScript String Object
Your message has been sent to W3Schools.