Still having problem with Record Collection

// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": '',
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
  if(id[prop] === ''){
     delete id[prop];
     console.log('yes its deleted');
  }
  if(prop === 'tracks' && id[prop] !== prop){
      id[prop] = [];
      id[prop] = [value];
  }
  else if(prop === 'tracks' && id[prop] !== ''){
      id[prop].push(value);
  }
   
  return collection;
}

// Alter values below to test your code
console.log(updateRecords(5439, "artist", "ABBA"));


I have been doing this for a long time ,but this time I understood the problem clearly  but still couldnt pass

You want to access value of an object through a prop. You should be targeting
collection[prop]

Go back to your code, you are making this mistake in other places.

Yeah didnt realise it was there,thanks in between

// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
  if(prop === 'tracks' && collection[id][prop] !== "tracks"){
    collection[id][prop] = [];
    collection[id][prop] = [value];
    console.log("This is creation");
  }
  else if(prop === 'tracks' && value !== ""){
    collection[id][prop].push(value);
    console.log("this is creation-2");
  }
  if(prop !== 'tracks' && value !== ''){
    collection[id][prop] = [] || collection[id][prop];
    console.log("updation");
  }
  if(value === ''){
    delete collection[id][prop];
    console.log("deletion");
  }

  
  return collection;
}

// Alter values below to test your code
console.log(updateRecords(5439, "artist", "ABBA"));

I have updated it a little

Only one of these two conditions so if you have already a tracks property inside the object for that id you are overwriting it as the first one is the one that always execute when you have prop being equal to "tracks"

This is always true as collection[id]["tracks"] is an array and will never be that string

Sorry I didnt get it
if prop is "tracks" but the album doesn’t have a "tracks" property
This statement is eating my mind

This is talking about the argument passed in the function, in the parameter prop

This instead about the object: you get the album object as collection[id] and you need to check that if it has a "tracks" property

Now I have updated it totally,can you explain.

// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
if(prop === 'tracks'){
  if(collection[id].hasOwnProperty('tracks') === false){
    collection[id][prop] = [];
    collection[id][prop] = [value];
    console.log("create-1");
  }
  else if(value !== ''){
    collection[id][prop] = collection[id][prop].push(value);
    console.log("create-2");
  }
} 
if(prop !== 'tracks' && value !== ''){
  collection[id][prop] = collection[id][prop] || [];
  console.log("updated"); 
}
if(value === ''){
  delete collection[id][prop];
  console.log("deleted");
  }
  return collection;
}

// Alter values below to test your code
console.log(updateRecords(5439, "artist", "ABBA"));

Explain what? Can you give more details on what you need explained and what you already understand?

// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
  if(prop !== "tracks" && value){
    collection[id][prop] = value;
  }
  else{
    if(!collection[id].hasOwnProperty("tracks"))
     { collection[id].tracks = [];
      collection[id].tracks.push(value);
    }
    
  }
  if(!value){
    delete collection[id][prop];
  }
  
  return collection;
}

// Alter values below to test your code
console.log(updateRecords(5439, "artist", "ABBA"));

I did this,but there one error which I dont know why it is not working,in the IF statement nested in the ELSE statement ,when I omit the curly braces its working,but I dont understand the point there ,can someone explain.

You are missing the check for when prop is "tracks" and value is not an empty string and for when the object does have the "tracks" property