我有两个对象列表,它们中有不同的字段。我想检查两个字段在 javascript 中是否具有相同的值。我的例子是清单一
0:Client_Issue_Reference__c:null
End__c:"2018-03-06T23:00:00.000Z"
Id:"a0Q2F000000oRyBUAU"
Resource_Full_Name__c:"test user"
Start__c:"2018-03-06T15:00:00.000Z"
我的第二个清单是
0:Id:"0050W000006r0xnQAA"
IsActive:true
Name:"test user"
我想看看 Resource_Full_Name__c != 我目前有没有名字
for (var i = 0; i < listOne.length; i++) {
for (var j = 0; j < listTwo.length; j++) {
if (listOne[i].Name != listTwo[j].Resource_Full_Name__c) {
buildingObjectAllUser = {}
sobjectType: "testObject";
buildingObjectAllUser.Id = listOne[i].Id;
buildingObjectAllUser.Start__c = "2018-03-06T23:00:00.000Z";
buildingObjectAllUser.End__c = "2018-03-06T23:00:00.000Z";
buildingObjectAllUser.Name = "No Hours";
buildingObjectAllUser.Resource_Full_Name__c = listOne[i].Name;
listThree.push(buildingObjectAllUser);
}
}
}
这个问题需要很多时间,它真的很慢