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

1 Answer

0 votes

The JavaScript string charAt() method is used to find out a char value present at the specified index. The index number starts from 0 and goes to n-1, where n is the length of the string. The index value can't be a negative, greater than or equal to the length of the string. For example:

  1. var str="Javatpoint";    
  2. document.writeln(str.charAt(4));    

Related questions

0 votes
asked Oct 19, 2019 in JavaScript by SakshiSharma
0 votes
asked Dec 4, 2020 in Amazon Elastic Compute Cloud EC2 by sharadyadav1986
0 votes
asked Nov 21, 2021 in MongoDB by DavidAnderson