Tell us what’s happening:
So I have tried multiple solutions to no avail, it still fails test 3, 5 and 6… Any suggestions please
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];
} else if (prop !== records[id]["tracks"] && value !=="") {
records[id][prop] = value;
} else if (prop === "tracks" && value !== "" && records[id]["tracks"] === undefined) {
records[id][prop] = [];
prop = value;
} else if(prop === "tracks" && value !== "" ) {
records[id][prop].push(value);
}
return records;
}
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Challenge Information:
Build a Record Collection - Build a Record Collection