ArrayFind

These functions searches the array for the specified object.

Returns: number

Usage

ArrayFind( array, value_or_closure )

Arguments

Argument Description
array
(array, required)

The array to search in

value_or_closure
(any, required)

The value to find or a closure/function that gets every value of the array as input and returns true if the given value is right.

Examples

Find first occurrence of string in array

fruitArray = ['apple', 'kiwi', 'banana', 'orange', 'mango', 'kiwi'];

favoriteFruits = arrayFind(fruitArray,'kiwi');
dump(favoriteFruits); //2

See also