JavaScript Array indexOf() Method
The indexOf() method returns the first index at which the element can be found in the array, or -1 if the element is not present. This method is case sensitive for string element. Syntax Parameters Parameters Descriptions searchElement The element whose index is to be find. fromIndex (Optional) Its default value is 0, which means…