I have this object of array
[
{
package_size: 12,
qty: 24
},
{
package_size: 24,
qty: 60
}
]
What I am trying to do:
If I added another object in this array and it has equal value to any of the package_size
for example if I want to add package_size: 12 && qty: 50 then the first element in the array become:
[
{
package_size: 12,
qty: 74
},
{
package_size: 24,
qty: 60
}
]