Tell us what’s happening:
Your code so far
// All inventory must be accounted for or you're fired!
for (var i = 0; i < arr1.length; i++) {
for (var j = 0; j < arr2.length; j++) {
if (arr2[j][1] == arr1[i][1]) {
arr1[i][0] += arr2[j][0];
}
}
}
return arr1;
}
// Example inventory lists
var curInv = [
[21, "Bowling Ball"],
[2, "Dirty Sock"],
[1, "Hair Pin"],
[5, "Microphone"]
];
var newInv = [
[2, "Hair Pin"],
[3, "Half-Eaten Apple"],
[67, "Bowling Ball"],
[7, "Toothpaste"]
];
updateInventory(curInv, newInv);
Hello guys im struggling in the part of pushing the new objects from the second array, the update of the number seems to work fine, but i am stuck in the other part! I dont want to solve it like the provided answer but in this way that im doing it! Can u please give me any tip?