Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 1.61 KB

File metadata and controls

64 lines (52 loc) · 1.61 KB
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
devlang-javascript
language-reference
charAt
JavaScript
TypeScript
DHTML
String object, returning characters
charAt method
characters, returning part of
63173e15-17f6-47c5-8f94-98ef1eb04c1a
14
mikejo5000
mikejo
ghogen

charAt Method (String) (JavaScript)

Returns the character at the specified index.

Syntax

  
strObj. charAt(index)  

Parameters

strObj
Required. Any String object or string literal.

index
Required. The zero-based index of the desired character.

Remarks

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.

Example

The following example illustrates the use of the charAt method:

var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";  
document.write(str.charAt(str.length - 1));  
  
// Output: Z  

Requirements

[!INCLUDEjsv1]

Applies To: String Object

See Also

String Object