📅  最后修改于: 2022-03-11 15:04:18.443000             🧑  作者: Mango
var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred', 'active': false }, { 'user': 'pebbles', 'active': true }]; _.findIndex(users, function(chr) { return chr.user == 'barney';});// => 0 // using the `_.matches` callback shorthand_.findIndex(users, { 'user': 'fred', 'active': false });// => 1 // using the `_.matchesProperty` callback shorthand_.findIndex(users, 'active', false);// => 0 // using the `_.property` callback shorthand_.findIndex(users, 'active');// => 2