Record Collection HELP required

I dont understand why there is a second if after if (prop === “tracks” && value !== “”). Do you need that second if? I thought you could just execute the piece of code straight after the first if statement was satisfied? I have tried removing it and played around with it a bit but cant get it to work. :confused:

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

  return collection;

tracks is an array. If you don’t check if that array exists, how can the logic work? You can’t push to something that isn’t there, and if you create a new array with one value in every time, if there was something these, it will get quotes out. If you remove the check, theres no way to differentiate between these two scenarios so the function naturally will not work.