| title | ms.custom | ms.date | ms.prod | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
charAt Method (String) (JavaScript) | Microsoft Docs |
01/18/2017 |
windows-client-threshold |
|
language-reference |
|
|
|
63173e15-17f6-47c5-8f94-98ef1eb04c1a |
14 |
mikejo5000 |
mikejo |
ghogen |
Returns the character at the specified index.
strObj. charAt(index)
strObj
Required. Any String object or string literal.
index
Required. The zero-based index of the desired character.
The charAt method returns a character value equal to the character at the specified index. The first character in a string is at index 0, the second is at index 1, and so forth. Values of index that are out of range return an empty string.
The following example illustrates the use of the charAt method:
var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
document.write(str.charAt(str.length - 1));
// Output: Z [!INCLUDEjsv1]
Applies To: String Object