Javascript union of two object
This question already has an answer here:
你可以使用jQuery.extend来实现你的愿望。
If you want to join the same keys into arrays like this:
Object { name: [" ", Array[x]], email: [" ", Array[y]] }
Try looping through each object and push the value:
var obj3 = {name:[],email:[]};
for(var i in obj1) {
obj3[i].push(obj1[i]);
}
for(var i in obj2) {
obj3[i].push(obj2[i]);
}
链接地址: http://www.djcxy.com/p/27336.html
下一篇: 两个对象的Javascript联合