Array扩展

Methods

Defined in: src\ArrayEx.js:7
Module: Extensions

Methods

indexFun

indexFun
(
  • existsFun
)

Defined in src\ArrayEx.js:25

查找数组中的元素的位置

Parameters:

nametypeflagdescription
existsFun Fun

验证当前元素是否符合查询规则

Example:

var array = [
    {id:1, name:"luolong" },
    {id:2, name:"chujun" },
];
var index = array.indexFun(function(item){
    return item.id == 1;
});
log(index);    
Top