Actualización de discos - UpdateRecords - Js

//Codigo resuelto

function updateRecords(records, id, prop, value) {

  if(value === ""){

         delete records[id][prop];

    

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

            if(records[id].hasOwnProperty(prop)){

            records[id][prop].push(value);

      }else{

            records[id][prop] = [];

            records[id][prop].push(value);
      }

     

  }else{
          records[id][prop] = value;
  }
      return records;
}
1 Like

Me alegro! Los videos son buenos para aprender temas no tanto para resolver ejercicios, saludos

1 Like

What happens is that I was watching the video as a guide, I had tried it alone without seeing it, but it cannot complete it so I tried to adapt a small part of its code (video) but it did not work for me, I still do not know how to share code here , I mean, as in discord they have these (`` `) to give color and that is not what an apology would be like here