I am working with several JavaScript objects:
{
x: 5,
y: 10,
z: 3
}
and
{
x: 7,
y: 2,
z: 9
}
My task is to add these two objects together based on their keys.
The resulting object should look like this:
{
x: 12,
y: 12,
z: 12
}
Do you have any suggestions or solutions in JavaScript?
I have tried using Object.keys.map
but it becomes unwieldy when dealing with a large number of elements in my object (around 100).