JavaScript

$u.a.find Function

Syntax

$u.a.find(arr as array, value as any [, findAll as boolean [, exactMatch as boolean]])

Arguments

arrarray

The array to search.

valueany

The value to search for in the array.

findAllboolean

(optional) A true/false value. If true, true, the function will search the entire array, and return an array of matching indexes. Otherwise it will return the index of the first match found.

exactMatchboolean

(optional) A true/false value. Specifies whether you would like to find exact matches, or any instances that contain the value passed in.

Description

Find a value in an array.

Example

var arr = ['one two','three','two three']
$u.a.find(arr,'three')
/* result is: 1*/
$u.a.find(arr,'three',true,false)
/* result is: [1,2]*/
$u.a.find(arr,'three',false,false)
/* result is: 0*/