Basic JavaScript - Record Collection

Could someone PLEASE tell me what’s wrong with my code? I just can’t get one last test checked and I don’t really know what’s wrong with it. Could somebody help me please?

  **Your code so far**
// Setup
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'

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

updateRecords(recordCollection, 5439, 'artist', 'ABBA');
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15

Challenge: Basic JavaScript - Record Collection

Link to the challenge:

Can you tell us which test is failing?

Ah, here is the big. records will never have that property.

Thank you! That was a lack of my attention. The test failing is: After updateRecords(recordCollection, 2468, "tracks", "Free") , tracks should have the string 1999 as the first element.

I fixed it but its still I’m still having the same issue. The test failing is : After updateRecords(recordCollection, 2468, "tracks", "Free") , tracks should have the string 1999 as the first element.

Did you fix this?

yes, I did. I fixed to “records[id][prop] = [value];” and I ran it again and the error stays :confused:

That’s not what I was talking about. That line didn’t have an error where you were directly checking the object ‘records’ for the property ‘tracks’

I’m sorry, English isn’t my first language so I didn’t really understand what you meant. I’m happy that I got most of the code done though and I appreciate you trying to help. Thank you.

Is it working? Did you fix this part:

1 Like

Thank you!! It finally worked! Thank you so much and I’m sorry for the misunderstanding

1 Like

I knew you could get there in the end. Good work!

1 Like

Thank you so much, Jeremy! God bless you!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.