Record Collection. Is there a bug?

I have written the following code to solve JS Record Collection challenge:

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

But everytime I run it, these 2 commands don’t get executed (FCC says empty strings must not change the corresponding property):

updateRecords(2548, "artist", "")

and

updateRecords(2548, "tracks", "")

I have run that same function I wrote on Google Dev tools and both “tracks” and ‘artist’ don’t change. Why then FCC evaluates it as incorrect? (Here is the link to challenge: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/record-collection)
Capture

If value is empty, the corresponding prop is supposed to be deleted.

1 Like