Record Collection mega.stuck(help, please)

Dear everyone who might read this, thank you in advance :slight_smile:
So, I am basically struggling to understand the assignments not sure if I am on the right path or not… I am aware that I am missing a point of the second request

“If prop is tracks but the album doesn’t have a tracks property, create an empty array and add value to it.

And ofc I didnt look at the solution yet beacue I would like my brain to do it no to copy it… so if anyone is so kind to rephrese the whole assignment would be incredibly appreciated.

My Code So far Is this:

function updateRecords(records, id, prop, value) {

  return records;

}

if ( prop != "tracks" && value != " ") {

recordCollection[prop] = value;

}else if( prop = "tracks"){

  recordCollection[tracks].add[prop];

}else if (propr = "tracks" && value != "") {

  recordCollection[tracks].push(value);

}else if (value == "") {

  delete recordCollection.prop

}

console.log(JSON.stringify(recordCollection));

updateRecords(recordCollection, 5439, 'artist', 'ABBA'

);


// 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) {
return records;
}

if ( prop != "tracks" && value != " "){
recordCollection[prop] = value;
}else if( prop = "tracks"){
recordCollection[tracks].add[prop];
}else if (propr = "tracks" && value != ""){
recordCollection[tracks].push(value);
}else if (value == ""){
delete recordCollection.prop
}


console.log(JSON.stringify(recordCollection));




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

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36

Challenge: Record Collection

Link to the challenge:

This is your function body… you have a ton outside of this function body. That can’t be good.

Also, the problem does not want you touching recordCollection!

1 Like