please give me a detailed explanation as to what i am doing wrong. i am extremely confused both with the problem and how its written.
Tell us what’s happening:
Describe your issue in detail here.
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) {
return records;
if(value===""){
delete records[id][prop];//If value is an empty string, delete the given prop property from the album.
}
if(prop!=="tracks"&&value!==""){
record[id][value]=[prop];
}//If prop isn't tracks and value isn't an empty string, assign the value to that album's prop.
If(prop==="tracks"&&value!==""&& "album"==="tracks"==="");{
records[id][prop]= [];
[value]= push[value];
}
}
//If prop is tracks and value isn't an empty string, you need to update the album's tracks array. First, if the album does not have a tracks property, assign it an empty array. Then add the value as the last item in the album's tracks array.
updateRecords(recordCollection, 5439, 'artist', 'ABBA');
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0
Challenge: Basic JavaScript - Record Collection
Link to the challenge:
