The indexOf() method returns the index of the first occurrence of the specified character (passed as an argument) in a string. If the character is present in the string, the method will return the index number; otherwise, it will return -1.
Syntax:
stringObject.indexOf(char)