zoukankan      html  css  js  c++  java
  • 判断多个数组里是否有相同的属性

    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 )  
     
  • 相关阅读:
    Spring MVC(一)
    Spring-IOC总结
    IT
    Spring基础
    Maven
    Ajax笔记
    数据库和SQL语言
    JDBC
    拦截器
    文件上传
  • 原文地址:https://www.cnblogs.com/zhangyongxi/p/10665434.html
Copyright © 2011-2022 走看看