对象中某一重复字段去重
let ar = [
{code: "a", number: "1"},
{code: "a", number: "2"},
{code: "b", number: "1"},
{code: "a", number: "2"},
{code: "b", number: "2"},
{code: "c", number: "1"},
]
-
去掉code相同并且number不等于2的对象
ar = [
{code: "a", number: "2"},
{code: "b", number: "2"},
]
2 .保留code不重复的,去掉code相同并且number不等于2的
ar = [
{code: "a", number: "2"},
{code: "b", number: "2"},
{code: "c", number: "1"},
]