Build a Record Collection - Build a Record Collection

Tell us what’s happening:

i got a right answer for all my tasks . but i did not pass them . can somebody tell me where is my problem.

Your code so far

const recordCollection = {
  2548: {
    albumTitle: 'Slippery When Wet',
    artist: 'Bon Jovi',
    tracks: ['Let It Rock', 'You Give Love a Bad Name']
  },
  2468: {
    albumTitle: '1999',
    artist: 'Prince',
    tracks: ['1999', 'Little Red Corvette']
  },
  1245: {
    artist: 'Robert Palmer',
    tracks: []
  },
  5439: {
    albumTitle: 'ABBA Gold'
  }
};


function updateRecords(records,id,prop,value){
  if(value==="") delete records[id][prop];
  if (prop!=="tracks" && value!=="")records[id][prop]=value;
  if(prop==="tracks" && value!=="" && records[id].hasOwnProperty("tracks")==false)records[id].tracks =value;
  if(prop ==="tracks" && value!=="")records[id][prop].push(value);
  
  return records;
}



//test 2
console.log(updateRecords(recordCollection, 5439, "artist", "ABBA"));

//test3
console.log(updateRecords(recordCollection, 5439, "tracks", "Take a Chance on Me"))

//4
console.log(updateRecords(recordCollection, 2548, "artist", ""))


//test5
console.log(updateRecords(recordCollection, 1245, "tracks", "Addicted to Love"))

//test6
console.log(updateRecords(recordCollection, 2468, "tracks", "Free"))

//test7
console.log(updateRecords(recordCollection, 2548, "tracks", ""))

//test8
console.log(updateRecords(recordCollection, 1245, "albumTitle", "Riptide"))


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0

Challenge Information:

Build a Record Collection - Build a Record Collection

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-record-collection/56533eb9ac21ba0edf2244cf.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @faezehhzz,

If I comment out all of your logs except test3, I see an error in the console:

TypeError: records[id][prop].push is not a function

Happy coding

I comment out all of my logs but still i have this error " You should have a updateRecords function." and none of my tests pass