$set.elementIndex($element)
Returns the position of an element in a list, counting from 0. If the element is contained more than once, the position of the first occurrence is returned.
| Name | Type | Description | Mandatory | Default |
|---|---|---|---|---|
| set | Set | A set in which the position of an element is to be determined. | yes | |
| element | Number/string/boolean/businss object/set | The element whose position is to be determined. | yes |
Type: Number
The index of the element's position in the set. If the element occurs more than once, the index of the first occurrence is returned. If the element is not contained at all, -1 is returned.
list(1, 2, 3, 4).elementIndex(2)
Output: 1
list(1, 2, 2, 2, 3, 4).elementIndex(2)
Output: 1
list(1, 2, 2, 2, 3, 4).elementIndex(8)
Output: -1