eg:
var obj1=[{a:1,b:2},{a:2,b:3}]
var obj2=[{c:3,d:2},{c:4,d:3}]
var resultArray=[];
for (var i = 0; i < obj1.length; i++) {
for (var j = 0; j < obj2.length; j++) {
if (obj1[i].b == obj2[j].d) {
resultArray=($.extend(obj1[i], obj2[j]));
}
}
}
结果:resultArray=[{a:1,b:2,c:3,d:2},{a:2,b:3,c:4,d:3}]
时间: 2024-11-05 12:12:22