> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-platform/6/studio/tasks/reference/array-index-of/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # arrayIndexOf > Use the indexOf task to find the first index position of an element in an array. The `arrayIndexOf` task returns the first index (position) at which a given element can be found in the array. The task returns `-1` if the element is not found. ## Potential use case Suppose you have a list of email addresses and want to determine if an email record is listed in the correct department. The `arrayIndexOf` task checks whether the email exists and returns the index position where it occurs. If the email is not found, it returns `-1`. ## Properties | Incoming | Type | Description | | :-------------- | :----- | :----------------------------------------------------------------- | | `arr` | Array | Required. The array to search. | | `searchElement` | Any | Required. The element to search for. | | `fromIndex` | Number | Optional. The index position to start the search. Defaults to `0`. | | Outgoing | Type | Description | | :------- | :----- | :--------------------------------------------------------------- | | `index` | Number | The position of the element in `arr`. Returns `-1` if not found. | ## Example In this example: * The `arr` variable is statically set to `["Apple","Pear","Banana"]`. * The `searchElement` is `Banana`. * The `fromIndex` defaults to `0`. * The `index` result returns `2`, indicating that `Banana` is at index position two in the array. Array indexing is zero-based: the first element is at position `0`, the second at `1`, and so on. ![](/_fern-img/73d080ea269c2df0eddc14d9e4ef8dde8a55f6900858ee0f2bb7534176cb3bfb.webp) > Use the indexOf task to find the first index position of an element in an array.