JavaScript: Record Collection - one test failing

function updateRecords(id, prop, value) {
  if(prop != "tracks") {
    if(value != "") {
      collection[id][prop] = value;
    }
  } else {
    if(!collection[id].hasOwnProperty(prop)) {
      collection[id][prop] = [];
    }
    if(value != "") {
      collection[id][prop].push(value);
    } else {
      delete collection[id][prop];
    }
  }
  return collection;
}

The following test won’t pass but I think it should -
After updateRecords(2548, “artist”, “”), artist should not be set

The property isn’t “tracks” so the first if-statement gets executed and then it performs a check if the value is not empty, which it is, so the block shouldn’t get executed and then it should skip the else of the outer if and then return the object (collection) unchanged.

I don’t know what I’m missing.

Link to the exercise - https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/record-collection

try to follow your if/else statements
the outer ones are

if (prop != "tracks") {
   ...
} else {
  ...
}

which one of the two branches would those values make execute?
and inside there, is there the required code to make the desired outcome happen?

ah, so i read the problem again and after a long thinking session came to realize that i need to delete the property if the value is empty even if the property isn’t “tracks”. silly me. thank you!

good job!
happy coding