String.charAt

charAt — Returns the specified character from a string primitive.

Description

String.charAt(integer index)

Parameters

Name Description Type Default Optional
index From 0 to string lenght - 1 integer No

Return values

string primitive.

Examples

Example #1 – charAt example
var str = new String('Foo Bar'); console.log(str.charAt(4)); // Will return "B".

External references