跳到主要内容

pluck

_.pluck(list, propertyName)
pluck 也许是 map 最常使用的用例模型的简化版本,即萃取数组对象中某属性值,返回一个数组。

var stooges = [{name: 'moe', age: 40}, {name: 'larry', age: 50}, {name: 'curly', age: 60}];
_.pluck(stooges, 'name');
=> ["moe", "larry", "curly"]