If we want to return the character from a specific index which method is used?

If we want to return the character from a specific index which method is used?

You can either directly use squre brackets to get the char at particular index:

string s = 'abc'
s[1] === 'b' // true

OR

You can use the String.charAt function to get the char at particular index of the string:

string s = 'abc'
s.charAt(0) === 'a' // true