myArr = [{"name":"abc"},{"name":"efg"},{"name":"abc"}]
如何消除具有冗余属性值的数组?
答案 0 :(得分:0)
如果您可以使用Underscore,则此处为inbuild function _.uniq
var myArr = [{"name":"abc"},{"name":"efg"},{"name":"abc"}];
var newArr = _.uniq(myArr, 'name');
输出:
[{"name":"abc"},{"name":"efg"}]