----------Record Collection(fcc)-------


// 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] = value;
  }
  else if(collection.hasOwnProperty("tracks") && prop == "tracks"){
    collection[id][prop] = [];
    collection[id][prop] = value;
  }
  else if(prop == "tracks" && value != ""){
    collection[id][prop] = collection[id][prop].push(value);
  }
  else if(value == ""){
    delete collection[id][prop];
  }
  
  return collection;
}

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

Hey what’s your question?

Its record Collection challenege,I am actually revising it,its not working

without you saying that you need help it’s not possible to know

anyway you have a big issue here:

The value needs to be set or updated ,so does this work as we are moving into the prop and manipulating the value.

collection[id][prop] = value;

I updated a bit

// 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.hasOwnProperty() == "tracks"  && prop == "tracks"){
    collection[id][prop] = [];
    collection[id][prop] = value;
  }
  else if(prop == "tracks" && value != ""){
    collection[id][prop] = collection[id][prop].push(value);
  }
  else if(value == ""){
    delete collection[id][prop];
  }
  return collection;
}

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

What does the tests say now?

I debugged it but nothing is happening

What do you mean with that? If you press Run tests what appear in the console?

Cannot read property 'push' of undefined
updateRecords(...)[1245].tracks.pop is not a function
After updateRecords(2468, "tracks", "Free"), tracks should have "1999" as the first element.

you need to redo this part
in the first else if you check if the object does have a "tracks" property, and if it has it you set the property first to an empty array than to a string. If it hasnt the track property than the next one is executed, and if the array doesnt exist you are trying to push a value to undefined
you will also want to check what push() actually returns - spoiler: it doesn’t return an array