• 从一个数组对象中过略出另一个数组含有的项


          const col = ['JiGouName','SchoolName']           
            const column= [
                            {title:'机构',dataIndex:'JiGouName'},
                            {title:'校区',dataIndex:'SchoolName'},
                            {title:'课程类别',dataIndex:'LessonClassName'},
                            {title:'课程',dataIndex:'LessonName'},
                            {title:'班级',dataIndex:'ClassName'},
                            {title:'学员',dataIndex:'StuName'},
                            {title:'交易类型',dataIndex:'TranType'},
                            {title:'订单类型',dataIndex:'OrderType'},
                            {title:'经办员',dataIndex:'JingBanYuan'},
                            {title:'销售员',dataIndex:'XiaoShouYuan'},
                        ]
            
            let tempArr=[];
            column.filter((co,i)=>{
                      let temp=col.indexOf(co.dataIndex);
                      if(temp>=0){
                          tempArr.push(co);
                            }
                      })   
            console.log('1', tempArr)   // 0:{title: "机构", dataIndex: "JiGouName"}
                                        // 1:{title: "校区", dataIndex: "SchoolName"}        
  • 相关阅读:
    树剖
    codeforces round 589
    codeforces round 590
    code craft 20
    Ozon Tech Challenge 2020 (Div.1 + Div.2)
    codeforces round 625
    Crime HDU
    codeforces 594
    codeforces 596
    python操作mysql方法和常见问题
  • 原文地址:https://www.cnblogs.com/aloehui/p/9141852.html
Copyright © 2020-2023  润新知