Standard built-ins

String.prototype.charAt()

Try the free JavaScript compiler

Reads a unit at a nonnegative integer index; out of range yields the empty string.

Formal Syntax & Structure

javascript syntaxjavascript
text.charAt(index)

Parameters & Attributes

NameTypeDescription
indexNumberIndex converted to an integer.

Return Value

String

One unit or empty string.

Working Example

Example Snippetjavascript
console.log("abc".charAt(1));
JavaScript Reference