JavaScriptStringat

Returns the character at a given index (supports negative indices).

Syntax

str.at(index)

Example

Enter values below to update the example in real time.

const
console
at
const text = "Hello";
console.log(text.at(0));    // "H"
console.log(text.at(-1));   // "o"