Tell us what’s happening:
To access the value of a key in this object, you will use bracket notation: records[id][prop]
. dont understand this statement
for example
if (value === “”) {
delete records[id][prop];
wouldnt you just use record[prop] in this case why add the [id]
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];
hello guys,kind of a dumb question but why would you use records[id][prop]; and not records[prop],
i saw this on tips [To access the value of a key in this object, you will use bracket notation: records[id][prop]. having a hard time understanding this please help
updateRecords(recordCollection, 5439, 'artist', 'ABBA');