Record Collection _unable to complete though code is correct

Tell us what’s happening:

Everything works except I am not able to delete the collection property.

Frequently getting error message - updateRecords(2548,“tracks”,""); and updateRecords(2548,“artist”,"");

I am unable to delete both properties, though my code is correct. I tested it separately on my computer. It works … but challenge is not showing success… someone help please…
Your code so far


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

  }else if(value == " ")
  {
    delete collection[id].prop;
  }
  
  
  return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
updateRecords(5439,"tracks","Take a Chance a Me");
updateRecords(2548,"artist","");
updateRecords(1245,"tracks","Addicted to Love");
updateRecords(2468,"tracks","Free");
updateRecords(2548,"tracks","");
updateRecords(1245,"album","Riptide");


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/record-collection/

Your code is not quite correct.
A property should be deleted if you are passed an empty string for value. But you are not checking for an empty string. You are checking for a string that contains one space.

Yes, that was the case… It got fixed … thank you !

I’m glad I could help. Happy coding!