Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
只需使用_。uniqby()它创建数组的重复版本即可。
_。uniqby()
var objects = [{points: 50, player: 'LeBron James'},{points: 32, player: 'Kevin Durant'},{points: 62, player: 'LeBron James'},{points: 90, player: 'LeBron James'}]; var result = _.head(_(objects) .countBy('player') .entries() .maxBy(_.last)); console.log(result);
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.19/lodash.min.js"></script>
Simply use _.uniqBy() It creates duplicate-free version of an array.
_.uniqBy()
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
只需使用
_。uniqby()
它创建数组的重复版本即可。Simply use
_.uniqBy()
It creates duplicate-free version of an array.