Tell us what’s happening:
I am only getting one to pass. I have seen this problem worked out before. So there are two parts to this. Validate the existing info and then allowing new info to be added to then update the Record Collection.
However, I am not sure of myself. The syntax is correct, yet what I’ve asked for is not doing anything. Plus, I believe that I should in some way be able to simplify the conditional statement better. But, I’m not fluid enough for that.
I need to understand exactly the what and why of the word problem, please.
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 (id === id) {
return records;
} else if (prop != tracks && value != "") {
return prop.hasOwnProp(value);
} else if (prop == tracks && tracks == "") {
return tracks + value;
} else if (prop == tracks && value != "") {
return tracks.push(value);
} else if (value == "") {
return id - prop;
} else {
return recordCollection;
}
console.log(updateRecords);
}
updateRecords(recordCollection, 5439, 'artist', 'ABBA');
type or paste code here
Your code so far