Write a function called mergeCounters which accepts two objects where all of the values are numbers and returns a new object with the total of both objects. The order of your returned object does not matter, as long as it contains the correct keys and values!
function mergeCounters (object1, object2) {
var myObj = {};
for (key in obj1) {
for (key2 in obj2) {
var val = myObj[key + key2];
}
}
return myObj;
}
var obj1 = {a: 1, b:2, c:3};
var obj2 = {a: 3, b:6, c:7};
console.log(mergeCounters(obj1, obj2)); // {a:4, b:8, c:10}
var obj3 = {a: 1, c:3, d:5};
var obj4 = {a: 3, b:6, c:7, z:20};
console.log(mergeCounters(obj3, obj4)); // {a:4, b:6, c:10, d:5, z:20}