判断多个数组里是否有相同的属性

var doctorAry = [ ] ;
var checkAry = [ ] ;
 
// datas是包含多个数组的大数组
// item 是每一个小数组
datas.map((item,index) => {
 
    if(checkAry.indexOf(item.doctorName) == -1){
 
                checkAry.push(item.doctorName)
 
                doctorAry.push(item)
 
    }
 
})
 
// doctorAry 是过滤出带有相同doctorName属性的大数组
console.log( doctorAry )  
 
原文地址:https://www.cnblogs.com/zhangyongxi/p/10665434.html