You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tania Shatilova edited this page Nov 10, 2015
·
1 revision
The arrayFirst() method returns the first item of an array that is matched the predicate function.
Syntax
varfirst=Mint.utils.arrayFirst(array,predicate);
Parameters
array - array in which item is searching.
predicate - (function) function that returns true for searching item.
Return Value
The first item of an array that is matched the predicate function; null if item is not found.
Examples
vararray=[1,3,8];varfirst=Mint.utils.arrayFirst(array,function(item){returnitem>2;});// first equal 3first=Mint.utils.arrayFirst(array,function(item){returnitem>10;});// first is null