Return the Unicode of the first character in a string:
The result of n will be:
The charCodeAt() method returns the Unicode of the character at the specified index in a string.
The index of the first character is 0, the second character 1, and so on.
![]()
The charCodeAt() 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 |
|---|---|
| Number | The unicode of the character at the specified index |
| JavaScript Version: | 1.2 |
|---|
Return the Unicode of the last character in a string:
The result of n will be:
JavaScript String Object
Your message has been sent to W3Schools.