I am faced with a challenge involving 3 objects of the same type, each having different values for their properties. My goal is to add them together as illustrated below:
Consider this scenario:
objA = {
data: {
SH: { propertyA: 0, propertyB: 3, propertyC: 0},
....
}
}
objB = {
data: {
SH: { propertyA: 0, propertyB: 0, propertyC: 1},
....
}
}
objC = {
data: {
SH: { propertyA: 4, propertyB: 0, propertyC: 0},
....
}
}
The desired outcome should look like this:
objC = {
data: {
SH: { propertyA: 4, propertyB: 3, propertyC: 1},
...
}
}
Is it feasible to perform such additions?
If not, could you propose an alternative coding method that does not involve maintaining three separate object types for each?
EDIT: When mentioning addition, I am referring to adding numerical values of properties from the three objects. While some properties may be strings, my focus lies only on numerical values.