我想用两个键从对象数组中删除重复的数据。有人可以帮助我吗?
var obj = [
{code:aaa, name:product1, variant:v1},
{code:aaa, name:product1, variant:v2},
{code:aaa, name:product1, variant:v1},
{code:abc, name:product2, variant:v1},
{code:xyz, name:product3, variant:v1}
];
答案应该是这样的:
[
{code:aaa, name:product1, variant:v1},
{code:aaa, name:product1, variant:v2},
{code:abc, name:product2, variant:v1},
{code:xyz, name:product3, variant:v1}
];
使用代码和变体删除重复项。