var arr =[
{
"platform_id": 1,
"type_id": 1,
"account_name": "asd",
"account_id": "asd"
},
{
"platform_id": 1,
"type_id": 8,
"account_name": "asd",
"account_id": "as"
},
{
"platform_id": 15,
"type_id": 1,
"account_name": "asd",
"account_id": "asd"
},
{
"platform_id": 15,
"type_id": 8,
"account_name": "asd",
"account_id": "asd"
}
]
for (var i = 0; i < arr.length - 1; i++) {
for (var j = i + 1; j < arr.length; j++) {
if (arr[i].platform_id === arr[j].platform_id && arr[i].account_id === arr[j].account_id) {
console.log("重名了!!");
}
}
}
js数组中对象字段判断重复
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。