-
Notifications
You must be signed in to change notification settings - Fork 0
Mint.utils.arrayFirst
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.
var first = Mint.utils.arrayFirst(array, predicate);- array - array in which item is searching.
- predicate - (function) function that returns true for searching item.
The first item of an array that is matched the predicate function; null if item is not found.
var array = [1, 3, 8];
var first = Mint.utils.arrayFirst(array, function (item){
return item > 2;
});
// first equal 3
first = Mint.utils.arrayFirst(array, function (item){
return item > 10;
});
// first is null