function unionProperties() { var ob1 = { "a": 1, "b": 2 }; var ob2 = { "a": 2, "b": 3 }; var ob3 = {}; for (var p in ob1) { if (p in ob2) { ob3[p] = ob1[p] + ob2[p]; } } alert(JSON.stringify(ob3));}