The below code is supposed to:
1) go through the two arrays,
2) if an item exist in both arrays, add its value to the value of the similar item in the first arra
You can merge the arrays Or combine the array so it will automatically do what you want .
var array3 = curInv.concat(newInv);
If you want to find the unique elements
// Merges both arrays and gets unique items var array3 = **
arrayUnique(array1.concat(array2));
function arrayUnique(array) {
var a = array.concat();
for(var i=0; i
**