Inventory Update - Help get it approved

Tell us what’s happening:

Hello, first of all, this is my first post here in the forum.
It has been an excellent help since i start studying here in the FCC and i am really thankful for everybody contributing here.

It happens that in this challenge i can’t have the exercise approved even with the correct result.

Is it possible that anyone could help me to understand what am i doing wrong?

Your code so far

function updateInventory(arr1, arr2) {

    // Return the index of the item in newInv if is in the curInv
    function checkItem (currentList, item){
        for (let i=0; i<currentList.length; i++){
            if (currentList[i][1] === item) {
                return i;
    // make a copy of the current inventory
    let returnInv = arr1;

    // Loop through all the new items to add the returnInv
    for (let i=0;i<arr2.length;i++){
        var index = checkItem(arr1, arr2[i][1])

        // add the quantity of the item if already exists
        if (index>=0){
        // add the new item and quantity to the return Inv

    //sort alphabetically
    return returnInv.sort((a,b)=>a[1]>b[1]);  

// 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);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36.

Link to the challenge:

Try a diffrend browser I copied past your code and it works for me as i passed the lesson with it.

Hey, the result your function returns isn’t quite right. It doesn’t seem to be sorting properly.

The Array.sort callback should return an integer, not a boolean.

Thank you M-Michelini.
I changed the array.sort callback and now is fully working in Chrome.
However i wonder i my initial solution was getting success in Firefox and not in Chrome.

Thanks KittyKora!
Does it have an explanation?

This old forum post should be helpful.

Yes there is one has something to do with the advancements in FCC and how things are set up here. I don’t know the excat details of it thou. Read it somewhere by one of the admins here. So far the sollution works thou trying a diffrend browser :3 helped out many peeps here.

I’m actually pretty sure in this instance it’s because because of the browser engines, so this would happen happen on any website, not just fcc.