Skip to main content

Find Index

Module Info:

moduleType: "internal",
moduleName: "findIndex"

Description

The findIndex function looks for an item inside an array and returns its index.

Inputs

NameTypeRequired
arrayArray<any>
searchedItemany

Outputs

NameType
resultnumber
notFoundMessagestring

notFoundMessage will only be defined if the item is not found.

Examples

Inputs Outputs
array searchedItem result notFoundMessage
[ "first", "second", "third" ] "second" 1 undefined
[ "first", "second", "third" ] "third" 2 undefined
[ "first", "second", "third" ] "foo" undefined "No item matchs in the given array"