Skip to content
陈广亮的技术博客
Go back

Underscore pluck 方法

var stooges = [
  { name: "moe", age: 40 },
  { name: "larry", age: 50 },
  { name: "curly", age: 60 },
];

_.pluck(stooges, "age"); // [40, 50, 60]
_.max(_.pluck(stooges, "age")); // 60
_.max(stooges, "age"); // {name: 'curly', age: 60}

Share this post on:

Previous Post
深入理解函数声明提升与变量声明提升
Next Post
Array forEach 在 IE 低版本的兼容