Good evening, everyone.
I am starting to lose my mind in this problem in specific. Is it something I’m not doing or something I’m doing wrong? I don’t know… if anyone could help me, I’ll be appreciated. I do not wish to someone to give me the answer, I just want someone to point up to me the direction I must go.
Link for the problem: Basic JavaScript - Record Collection
// 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 == records.id.prop.value[""]) {
delete records.id.prop;
}
else if (prop == records.id.prop["tracks"] && value != records.id.prop.value[""]) {
records.id.prop.push(value);
}
else if (prop == records.id.prop["tracks"] && records.id.hasOwnProperty[tracks] == False) {
records.id.prop = [value];
}
else if (prop != records.id.prop["tracks"] && value != records.id.prop.value[""]) {
records.id.prop = value;
}
return records;
}
updateRecords(recordCollection, 5439, 'artist', 'ABBA');