The indexOf() method in JavaScript returns the position of the first occurrence of a specified _______ within a string.

  • Character
  • Element
  • Substring
  • Value
The indexOf() method returns the position of the first occurrence of a specified character within a string. It helps in finding the index of a particular character or substring.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *