JavaScript String indexOf() method

The JavaScript string indexOf() method retrieves the position of a char value present in the given string. It is case-sensitive. Syntax 1: string.indexOf(char) Syntax 2: string.indexOf(ch,index) Syntax 3: string.indexOf(str) Syntax 4: string.indexOf(str,index) Parameters: char: It represents the specified char like “c”. str: It represents the specified string like “w3spoint”. index: It represents the specified position … Read more