After i have the answer, why wont freecodecamp let me proceed in the inventory update section, here is my code
> var arrQty = [];
> var arrItmName = [];
>
> var arr = [];
> function updateInventory(arr1, arr2) {
> count = 0;
> // All inventory must be accounted for or you're fired!
> $.each(arr1, (arr1Key, arr1Val)=>{
> arrQty.push(arr1Val[0]);
> arrItmName.push(arr1Val[1]);
> });
>
> $.each(arr2, (arr2Key, arr2Val)=>{
> if($.inArray(arr2Val[1], arrItmName) === -1){
> arrQty.push(arr2Val[0]);
> arrItmName.push(arr2Val[1]);
> }else{
> arrQty[arrItmName.indexOf(arr2Val[1])] = arrQty[arrItmName.indexOf(arr2Val[1])] + arr2Val[0];
> }
> });
> for(var i=0; i<arrQty.length; i++){
> var columns = [];
> for(var j=0; j<arrItmName.length; j++){
> columns[0] = arrQty[count];
> columns[1] = arrItmName[count];
> break;
> }
> arr.push(columns);
> count++;
> }
> arr.sort(function(a, b){
> if(a[1] < b[1]) return -1;
> if(a[1] > b[1]) return 1;
> return 0;
> });
> return arr;
> }
> // 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);