JavaScript charAt method

The javascript charat method returns the character at the specified index in a string.
The index of the first character is 0, the second character is 1, and so on.

Syntax:

string.charAt(index)
where, Required. An integer representing the index of the character you want to return.

Example:

var str = “This is JavaScript charAt() Method”;
var n = str.charAt(0);
alert(n);

Live Demo: JavaScript charAt method

Leave a Reply