Locate the position of an item within a list.
import
public |
The indexOf() method returns the position of the first occurrence of a value in the list. If the item is not found in the list then it returns -1.
public |
Parameter |
Description |
item |
Necessary. The item being sought within the list. |
Returns: |
The index of the first occurrence of the item in the list, or -1 if the item is not present. |