ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

【JavaScript】判断数组对象是否存在某项值

2022-06-24 18:36:01  阅读:56  来源: 互联网

标签:JavaScript 数组 WorkTypeId 某项 WorkTypeName var value1 WorkTypeList standardWorkTyp


var WorkTypeList = [{ 'WorkTypeId': 1, 'WorkTypeName': '企业主要负责人(A证)' },
{ 'WorkTypeId': 2, 'WorkTypeName': '项目负责人(B证)' },
{ 'WorkTypeId': 3, 'WorkTypeName': '专职安全生产管理人员(C证)' }];  
var standardWorkType = [];

$.each(WorkTypeList, function (index1, value1) {
    if (!standardWorkType.find(element => element.WorkTypeId == value1.WorkTypeId)) {
        standardWorkType.push({ 'WorkTypeId': value1.WorkTypeId, 'WorkTypeName': value1.WorkTypeName });
    }
})

 

搜索

复制

<iframe height="240" width="320"></iframe>

标签:JavaScript,数组,WorkTypeId,某项,WorkTypeName,var,value1,WorkTypeList,standardWorkTyp
来源: https://www.cnblogs.com/zhaoyl9/p/16409879.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有