Question:What is the function of indexOf()?
Answer The indexOf() method returns the position of the first occurrence of a specified value in a string. This method returns- 1 if the value which is searched never occurs. Example:
var str="Hello world, welcome to Bangladesh." var ind=str.indexOf("welcome");Output:13
+ Report
What is the function of indexOf()?