String.charAt() method is used to get the character from the string at given index.
stris a string.
nis an integer (position/index).
charAt() method returns the character from string
str present at the index
1. In the following program, we get char at index=3 in the string
let name = 'apple'; let output = name.charAt(3); console.log(output); //output: l
2. In the following program, we take the value of
n outside the range of string, that is given index is out of the bounds of the string. Then
charAt() returns empty string value.
let name = 'apple'; let output = name.charAt(15); console.log(output); //output: